Payments require handling sensitive data. The code examples below demonstrate the integration pattern and should not be used in production as-is. In production, store sensitive information such as API keys and private keys in a secrets manager or vault.
Crypto/Onramp_sessions API is enabled on your account. The examples below use Stripe’s Sandbox environment.
Prerequisites
Create an on-ramp session on the server
Create the session server-side and return only theclient_secret to the frontend. Never expose your STRIPE_SECRET_KEY to the client.
Using cURL:
client_secret:
Mount the on-ramp widget on the frontend
Pass theclient_secret from your server response to the Stripe on-ramp widget: