Having built many bubble apps, I still feel like I know nothing about Stripe. There are many great resources but it is never enough because Stripe is really powerful! So I decided to write a thread and share my experience of integrating Stripe. Hope this helps someone in the future. And if you have any suggestions, please let me know.
My first documentation is about Stripe connect and subscription. Our team just built an app that allows users to create their own subscription plans. It has the following features:
- onboarding sellers with Stripe Connect
- create product and price with APIs (subscription plan)
- create a checkout session
- webhooks to receive messages when a subscription is paid
If you are building a subscription platform like Patreon or SubStack, this guide may help.
There are three types of seller accounts.
We decided to use the Standard Account this time. There are at least two ways to create a standard account: With APIs, or with OAuth Connect. We choose OAuth Connect because it enables users to connect their existing Stripe accounts. Basically, we only need to create a button that links to Stripe and a redirect page to redirect the users when they have created the seller account.
To create a Standard Account, we need to navigate our users to a Stripe onboarding page. Stripe will handle the onboarding and identity verification processes.
Before onboarding your sellers, make sure you have set up and activated your Stripe account. Go to your Stripe dashboard > Settings > Connect > Settings. Customize the visual appearance of the onboarding page.
Remember to enable OAuth flow and add a redirect link. Create an empty bubble page to be the redirect link. We will add workflows to this page later.
Copy the client id. We will use the id to create an URL for the OAuth flow.
Client ID example: ca_HUgW0aGkpo4hR9y4qJmCTnVd0vozGvjV
- client_id: Your Stripe Connect client id. Find your client id here: https://dashboard.stripe.com/settings/connect
- redirect_uri: The URL must be added in step 1. If no
redirect_uriis specified, Stripe uses the first URI configured in your platform settings.
Create a button with the workflow action “Open an external website”. Add the URL into the destination field.
Now we should be able to see the onboarding page when we click the button.
When users completed the onboarding flow, Stripe redirects them back to our page. We can add a “page is loaded” workflow to complete the onboarding flow. We will need an API to create an account and get the account ID.
- Authorization: Bearer <client_secret>.
code: Get “code” from page URL. Stripe will add parameters to our redirect URL. We can get the code by the dynamic expression “Get data from page URL”
stripe_user_id: The unique ID of the seller account.
The Standard account has been successfully created. Remember to save the seller ID. We will use the ID to make requests on behalf of the seller. Next, we are going to create a subscription plan for our users with APIs.