Onramp Kit

⚠️ Warning ⚠️

This package is provided for testing purposes only. It's not ready for production use. We are working with Stripe and participating in the pilot test for their new crypto on-ramp. Considering this, we provide a public key and a testing server already configured during the Safe Account Abstraction hackathon
Once the hackathon and Stripe pilot are over, the server will be removed and you should use your own keys and server in case you opt-in for the StripeAdapter.
Currently this package is only prepared to work with Stripe. See considerations and limitations for more details.

OnRamp Kit

The Onramp kit allows users to buy cryptocurrencies using a credit card and other payment options.



The docs for the latest step (server) are not published yet as Stripe onramp solution is still in pilot testing

Install dependencies

yarn add @safe-global/onramp-kit

How to use

Create an instance of the SafeOnRampKit using SafeSafeOnRampProviderType and SafeOnRampConfig as parameters.
With Stripe
import { SafeOnRampKit, SafeOnRampProviderType } from '@safe-global/onramp-kit'
const safeOnRamp = await SafeOnRampKit.init(SafeOnRampProviderType.Stripe, {
onRampProviderConfig: {
stripePublicKey: <Your public key>, // You should get your own public and private keys from Stripe
onRampBackendUrl: <Your backend url> // You should deploy your own server
You can check this server implementation as an example.
Currently we are providing both the public key and the server for testing purposes. In the future you will need to use your own public key and server based on the final documentation Stripe will provide once their on ramps solution is ready for production. See the considerations and limitations section for more details.
Once the instance is created, you can call the open(SafeOnRampOpenOptions) method to start the session with the provider and opening the widget.
As an example, you can use the following code:
const sessionData = await{
networks: ['polygon']
element: '#stripe-root',
sessionId: 'cos_1Mei3cKSn9ArdBimJhkCt1XC', // Optional, if you want to use a specific created session
events: {
onLoaded: () => console.log('Loaded'),
onPaymentSuccessful: () => console.log('Payment successful')
onPaymentError: () => console.log('Payment failed')
onPaymentProcessing: () => console.log('Payment processing')

Considerations and limitations

  1. 1.
    The library is under development and it's not ready for production use. We are working with Stripe and participating in the pilot testing for their new on ramp solution
    Considering this, we provide a public key and a deployed server only available for testing purposes. It can be used like this:
const safeOnRamp = await SafeOnRampKit.init(SafeOnRampProviderType.Stripe, {
onRampProviderConfig: {
'pk_test_51MZbmZKSn9ArdBimSyl5i8DqfcnlhyhJHD8bF2wKrGkpvNWyPvBAYtE211oHda0X3Ea1n4e9J9nh2JkpC7Sxm5a200Ug9ijfoO', // Safe public key
onRampBackendUrl: '', // Safe deployed server
  1. 2.
    As we are working on Stripe testmode, the purchases are simulated. You must use fake data for KYC process and payments in the Stripe embedded widget. Please use the following dummy data:
  • Use any test or fake emails such as [email protected]. Emails previously used with the on-ramp (i.e. have a Link account) will trigger a returning user OTP immediately, skipping the sign up screen
  • Use +18004444444 for phone number
  • Use 000000 for the OTP verification code
  • Use any first name such as John but specifically Verified for the last name and 01/01/1901 for the birthday for successful identity verification.
  • Select Social Security Number for identification type and then enter 000000000 for fill the field
  • Select United States for country
  • Use address_full_match for address line 1 for successful identity verification
  • Use Seattle for city
  • Select Washington for state
  • Use 12345 for zip code
  • To receive testnet assets, use a network compatible wallet that you control
  • Use test credit card 4242424242424242 with future expiration date 12/24, any CVC 123, and any zip code 12345. You can find more details on testing payment methods here.
  1. 3.
    When using testnets such as Polygon Mumbai, the cryptocurrencies will be transferred. PLEASE DO TRY TO USE LOWER AMOUNTS to preserve testnet's liquidity, ESPECIALLY THE USDC TOKEN ON POLYGON MUMBAI.
    In any case, for avoiding this, we limit the amount you can buy to 10 monetary currency units, so if you try to buy more than that an error will be thrown.
  2. 4.
    If you want to deploy a POC with your solution, bear in mind that our integration with Stripe has the following domains whitelisted:
    So you can deploy your solution in one of these hosting providers. Using a different domain won't work and the widget will throw an error.
  3. 5.
    Currently the Stripe widget can only be used if you are connecting from the United States. If this is not the case you will receive a load error.


Check out a functional demo using the onramp-kit
Last modified 4h ago