💳
Stripe Checkout Connect - Bubble Plugin by Thimo
  • Get started
    • Introduction
    • Plugin setup
  • Connecting Stripe Accounts
    • Onboarding a user (connecting Stripe account)
    • Retrieve account information
    • How to retrieve Pending and Available balances
  • Single marketplace payments
    • Creating single marketplace payments
    • How to retrieve Checkout Session details?
    • Refund a payment (Single Payment)
    • How to retrieve payment details?
  • Marketplace subscriptions
    • Creating subscription marketplace payments
    • Refund a payment (Subscription Payment)
    • How to list invoices for a subscription?
    • How to cancel a subscription?
    • How to retrieve subscription details?
    • How to handle failed subscription payments?
  • For Express accounts
    • How to change a Payout Schedule for an account? (for Express accounts)
    • How to redirect user to the Express Dashboard? (for Express accounts)
    • How to perform a manual payout? (For Express accounts)
Powered by GitBook
On this page
  • Getting started
  • Step 1 - Page contents
  • Step 2 - Create a Checkout Session
  • Step 3 - Save Checkout Session details
  • Step 4 - Redirect user to Checkout URL
  • Step 4.5 - Retrieve the Payment Intent ID
  • Step 5 - Check if the payment succeeded
  • Alternative step 5
  1. Single marketplace payments

Creating single marketplace payments

This section will go over how to create a one-time marketplace payment and taking a fee using the plugin.

PreviousHow to retrieve Pending and Available balancesNextHow to retrieve Checkout Session details?

Last updated 1 year ago

Getting started

In this section we will create payments for connected accounts while taking a fee using Checkout. To start, make sure to:

  • Add the plugin to your app

  • Have a simple page with a button users can use to trigger the payment flow (we will go over this further on in this section)

  • Make sure the user has completed the

➡️ You can take a look at the plugin demo created in this section here:

Step 1 - Page contents

We are going to setup a page with a button that triggers the Stripe Checkout flow. Keep in mind we need to save the Checkout ID to the database, so setup your database structure accordingly.

⚠️ IMPORTANT NOTE:

Previously we could just save the Payment Intent ID when creating a Checkout Session, but the latest Stripe API versions do no return the Payment Intent ID when creating a checkout session. You can get the Payment Intent ID only when a Checkout Session is confirmed (payed). You can get the Payment Intent ID for a confirmed Checkout Session via a Stripe webhook or details call which is provided by the plugin.

The demo page has a really simple example database structure, but you can always use your own. The following section demos the one-time payment integration:

Step 2 - Create a Checkout Session

To create a Checkout Session we will run the 'Stripe Connect - Checkout Single Payment' workflow action. We will input all the necessary information, like the Connected account ID from the user we just onboarded. The Success URL is used to redirect the user when the transaction flow is finished and the a Cancel URL is used to redirect the user when the transaction flow is cancelled. NOTE: We still need to check if the payment succeeded when the user lands on the Success URL (you can read more about this further on).

Step 3 - Save Checkout Session details

In the demo this data entry is saved to the user type:

Step 4 - Redirect user to Checkout URL

The 'Stripe Connect - Checkout Single Payment' workflow action also returns the Checkout URL to complete the payment. You will need to redirect the user to this URL like this:

Step 4.5 - Retrieve the Payment Intent ID

Step 5 - Check if the payment succeeded

When the user is send back to your Success URL we need to check if the payment succeeded. For this we will use the 'GET Payment Intent Details' data call.

For this call we need to enter the Payment Intent ID we saved to the database and the Account ID pointing to the onboarded user.

You can display / use this information how you like in your app!

Alternative step 5

Instead of checking if the Payment succeeded client side, you can also setup up a Stripe webhook inside Stripe to be notified if a user completes the Payment. Keep in mind that you need to be on a paid Bubble plan for this as you need to use a Backend workflow.

On the demo page we create a database item called 'One-time payment' to save the necessary Checkout to later check if the transaction succeeded and to get the transaction details. Important here is to save the Checkout ID (ONLY old Stripe API versions can also save the Payment Intent ID in this step, read more ).

Previously we could just save the Payment Intent ID when creating a Checkout Session, but the latest Stripe API versions do no return the Payment Intent ID when creating a checkout session. You can get the Payment Intent ID only when a Checkout Session is confirmed (payed). You can get the Payment Intent ID for a confirmed Checkout Session via a Stripe webhook or details call which is provided by the plugin.

Next we can look at the status field to see if it is set to "succeeded". You can read more about the different status fields here:

GET Checkout Session
https://docs.stripe.com/payments/paymentintents/lifecycle#intent-statuses
here
Onboarding steps
https://bubble.io/page?name=index&id=stripeconnectdemo&tab=tabs-1
GET Checkout Session
demo page