Web Integration
Sardine’s web checkout widget offers a quick way to integrate our Crypto On/off-Ramp via a URL
This is best suited for quick integrations where the developer does not want to build their own UI. The Sardine Risk SDK is natively integrated into the checkout flow.
Goal
By the end of this guide, you should be able to open a new window with Sardine On/Off-ramp, either in a new tab or in a new browser window.
1. Obtain authorization token
Before we start, you’ll need the following credentials
You will need to obtain the clientToken
, which is a unique identifier for each session and user.
Make a POST request to /client-tokens
using Basic Auth by passing base64 encoding of <clientId>:<clientSecret>
If the request is successful, you should receive a response that contains the clientToken
and expiresAt
field
2. Determine your widget configuration and create URL.
Sardine’s widget can be configured based on any parameters that are passed through. Please use the configuration reference guide.
By default, if no parameters are passed, users will be redirected to our standard checkout widget.
client_token
is the only required parameter. Additional parameters that are passed will autofill the widget for the user and allow them to skip some screens.
Supported tokens in Sandbox
Currently Sardine only supports a subset of tokens available in production on its sandbox environment. We recommend using the GET /supported-tokens endpoint to fetch the list of tokens available
3. Implement the web checkout widget
Once the URL has been generated, it can be embedded into your web app as a hyperlink. Below, we have included samples of different ways of integrating the checkout
If embedding an iframe, make sure to pass camera and geolocation permission allow="camera *;geolocation *"
for proper KYC collection
Recommended size is width=500, height=700 for new window
4. Confirmation of Order Status
Sardine will fire off events that can be caught by event handlers that can be leveraged to update the user on the order status
There are two ways to get Order status
Developers can poll to the /orders endpoint to check its status with the order_id
5. Testing and Verification
Once the defined URL has been set and triggered, it should open a window that goes through the user flows for Sardine’s on ramp.
A developer can use the sample information provided in the Testing Payment Flows page to test the integration.
6. Going Live in Production
Once you have completed end-to-end testing in sandbox, you can go live by swapping to a set of production keys and updating your URLs. Please see the linked guide for a step-by-step of going live in production.
You should now be able to route users to the Sardine Checkout Widget via your defined URL where they can instantly buy crypto tokens!