Set up an embeddable onramp integrationBeta
Use this guide to fully customise the embeddable onramp.
To integrate with the onramp SDK:
- Install the SDK and client library.
- Generate a crypto onramp session on your back end.
- Render the onramp UI on your website.
- View your integration’s usage in the Stripe Dashboard.
Install the SDK and client libraryclient-sideserver-side
Client-side
Include the following scripts using script tags within the <head>
element of your HTML. These scripts must always load directly from Stripe’s domains (https://js.stripe.com and https://crypto-js.stripe.com) for compatibility and PCI compliance. Don’t include the scripts in a bundle or host a copy yourself. If you do, your integration might break without warning.
<head> <title>Onramp</title> <script src="https://js.stripe.com/v3/"></script> <script src="https://crypto-js.stripe.com/crypto-onramp-outer.js"></script> </head>
Use the Onramp JS SDK as a module
Use the npm package to load the onramp JS SDK as an ES module. The package includes Typescript type definitions.
npm install --save @stripe/stripe-js @stripe/crypto
Server-side
Our official libraries don’t contain built-in support for the API endpoints because the onramp API is in limited beta. As a result, our examples use curl for back-end interactions.
Generate a crypto onramp sessionserver-side
Generate a crypto onramp session by running the following curl command in your terminal:
curl -X POST https://api.stripe.com/v1/crypto/onramp_sessions \ -u
: \ -d "wallet_addresses[ethereum]"="0xB00F0759DbeeF5E543Cc3E3B07A6442F5f3928a2" # add as many parameters as you'd likesk_test_4eC39HqLyjWDarjtT1zdp7dc
You receive a response similar to the following:
{ "id": "cos_0MYfrA589O8KAxCGEDdIVYy3", "object": "crypto.onramp_session", "client_secret": "cos_0MYfrA589O8KAxCGEDdIVYy3_secret_rnpnWaxQbYQOvp6nVMvEeczx300NRU4hErZ", "created": 1675732824, "livemode": false, "status": "initialized", "transaction_details": { "destination_currency": null, "destination_amount": null, "destination_network": null, "fees": null, "lock_wallet_address": false, "source_currency": null, "source_amount": null, "destination_currencies": [ "btc", "eth", "sol", "usdc" ], "destination_networks": [ "bitcoin", "ethereum", "solana" ], "transaction_id": null, "wallet_address": null, "wallet_addresses": { "bitcoin": null, "ethereum": "0xB00F0759DbeeF5E543Cc3E3B07A6442F5f3928a2", "polygon": null, "solana": null } } }
See the Onramp API reference for the full parameter list you can pass in when creating a session.
Render the Onramp UIclient-side
After running the script, the onramp renders the following window:
Stripe’s fiat-to-crypto onramp embedded within a third-party application
Test mode values
Warning
Test mode transaction amounts are overridden by our pre-decided limits.
Use the following values to complete an onramp transaction in test mode:
- On the OTP screen, use
000000
for the verification code. - On the personal information screen, use
000000000
for the SSN andaddress_
for address line 1.full_ match - On the payment details screen, use the test credit card number
4242424242424242
.
View integration usage
After you’ve launched the onramp, you can view customised usage reports in the Stripe Dashboard. You can also return to the onboarding page to update the domains where you plan to host the onramp, and check the status of any onboarding tasks.