Search code examples
javascriptpythonstripe-paymentspayment

Stripe Payment Intent / Setup Intent combination in python


We want to have a SetupIntent and PaymentIntent confirmed at the same time. The reason is that we have a product which is paid yearly (beginning) and also metered billing where the customer pays based on usage each month. Because of the dual durations (month/year) we have two subscriptions with one subscription item each. To activate one of them we give the client_secret to the frontend where it is used to send payment data.

How can I use that to activate both the SetupIntent and the PaymentIntent as well without sending the customer both client_secrets and expecting to fill out the card data twice.

Beset regards and nice weekend!


Solution

  • I found a solution, where a proof of concept in the test world worked:

    1. Create a setup intent
    2. Give the secret to the user
    3. As soon as the payment method is accepted, I can create both subscriptions
    4. For knowing WHICH subscriptions to create, I put those data into the metadata field -> Can use this data in the called webhook :)
    5. In the webhook I can then create and directly confirm the subscriptions :)

    done!

    Sounds reasonable, right?