Chris
Chris

Reputation: 355

Creating a subscription when using Bancontact

I'm setting up Bancontact as a payment method for a client for customers who create a subscription.

I can create the setupIntent, but where I'm getting stuck is at what point do I create the subscription in Stripe and how do I get the product details to create the subscription. Paying with Bancontact means the customer is redirected to Bancontact (when I call confirmBancontactSetup), and then they will redirect back to a URL I provide once payment has been authorised, but I only get a setup_intent identifier and setup_intent_client_secret in the querystring so how do I retrieve the product details with these?

I was trying to use the setup_intent.succeeded hook to create the subscription, but again I only get the setupIntent object - can I get the product details using this?

I'm new to Stripe so there's probably an easy solution to this but I haven't been able to find documentation for this specific use case anywhere.

EDIT: I've realised that I do actually have access to the cart when Bancontact redirects back to the site, so I could create the subscription then - but I would rather create it in the setup_intent.succeeded hook if possible.

Upvotes: 0

Views: 76

Answers (1)

pgs
pgs

Reputation: 1181

The SetupIntent was created on your end and it does not contain any product details. To resolve this, you can pass in the metadata [0] parameter to leverage the setup_intent.succeeded event or store this information in your database. This allows you to identify your product details to use in your subscription creation.

[0] https://stripe.com/docs/api/setup_intents/object#setup_intent_object-metadata

Upvotes: 1

Related Questions