Userbase

Docs : SDK : purchaseSubscription

purchaseSubscription redirects your users to a Stripe Checkout form, a Stripe-hosted payment page designed to reduce friction accepting payment from your users. To call this function, you must first do the following:

And you're good to go!

userbase.purchaseSubscription({
  successUrl: 'https://example.com/success',
  cancelUrl: 'https://example.com/cancel',
  priceId: 'price_1HsI6AE3KJTop1QHR00YQXPr'
}).then(() => {
  // user successfully redirected to Stripe Checkout form
}).catch((e) => console.error(e))

Parameters

Notes

Advanced

Errors