Sign in
An image of the Stripe logo
Create account
Sign in
Home
Payments
Business operations
Financial services
Developer tools
No-code
All products
Home
Payments
Business operations
Home
Payments
Business operations
Financial services
Developer tools
Support
Overview
Issuing cards
Crypto
    Fiat-to-crypto onramp
      Overview
      Quickstart
      Integrate the onramp
      Using the API
      Integration recipes
      Mobile Integration
      Quotes API
      ES Module
    Crypto payouts
Treasury
Business financing
HomeFinancial servicesCryptoFiat-to-crypto onramp

Stripe Crypto SDK ES Module

Set up the Stripe crypto client-side SDK in your web application.

See the code

View the package on npm to learn how ES Module Stripe crypto SDK works.

This introductory guide shows you how to install the Stripe crypto ES module client-side SDK with a script tag or package manager. The SDK wraps the global StripeOnramp function provided by the Stripe crypto script as an ES module. It allows you to use the onramp widget to help your customers to acquire crypto using fiat.

Manually load the Stripe crypto script

Installation

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>

StripeOnramp constructor

Set the API publishable key to allow Stripe to retrieve the OnrampSession object created by your backend. For example:

const stripeOnramp = StripeOnramp(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
);

Load Stripe crypto SDK as an ES module

Installation

To install through the package manager, install the Stripe.js ES module and Stripe crypto ES module from the npm public registry. The package includes Typescript type definitions.

npm install @stripe/stripe-js @stripe/crypto

StripeOnramp constructor

Import the module and set the API publishable key to allow Stripe to retrieve the OnrampSession object created by your backend. The function returns a Promise object that resolves with a newly created StripeOnramp object after the scripts load.

import {loadStripeOnramp} from '@stripe/crypto'; const stripeOnramp = await loadStripeOnramp(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
);

See also

  • Integrate the onramp
Was this page helpful?
Questions? Contact us.
Watch our developer tutorials.
Check out our product changelog.
Powered by Markdoc
You can unsubscribe at any time. Read our privacy policy.
On this page
Manually load the Stripe crypto script
Load Stripe crypto SDK as an ES module
See also
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Login to your Stripe account and press Control + Backtick on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g. )
The Stripe Shell is best experienced on desktop.
$