Mobile Integration
You can quickly integrate Sardine Crypto On-ramp fiat via a mobile interface. For Mobile URL Webview implemenations, the checkout widget is generated via URL.
***Goal
By the end, you should be able to embed Sardine On-ramp into your mobile app through a WebView
0. Integrate the Risk SDK
Our Risk SDK is a mandatory requirement to help us fight fraud via device intelligence and behavior biometrics. Sardine’s proprietary technology is adept at this very task and is instrumental in identifying risky devices, behavior, and tools that are used during these sessions (example: VPNs, emulators, remote desktop protocols etc.)
Benefits of adding Risk SDK
-
Higher limts for good users
-
Better fraud identification
-
Less friction for good users
Select the Mobile SDK as per your need:
Android |
iOS |
ReactNative |
Flutter |
If you are unable to view the documents in the links above, please reach out to your Sardine representative to get access.
1. Obtain authorization token
Before we start, you’ll need the following credentials
You will need to obtain a 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.
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
To assist with development, we have created some code samples which illustrate how your code can be structured to create the checkout url and handle the finished trade.
allowsInlineMediaPlayback
should be enabled either via code or through storyboard
-
Start by importing Webview
-
Craft the URL based on preferred parameters
-
Create event handlers that will catch the
processed
,expired
anddeclined
events -
Call the WebView component with parameters set as such. These have been set for the optimal user expereince.
Full code should look as such
4. Confirmation of Order Status
Sardine can fire off events that can be caught by event handlers that can be leveraged to update the user on the order status outside of the Sardine widget
There are two ways to get Order status, either via polling an orders endpoint or providing a redirect URL that we will send the events to
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 use an integrated Sardine Checkout Widget!