#tristanoneil-bacs-mandate
1 messages ยท Page 1 of 1 (latest)
Okay if you're using webhooks,
for one time payments you can listen to the checkout.session.completed webhook event then retrieve the PaymentIntent and look at the most recent's Charge's payment_method_details to get the mandate ID
Same for subscriptions but you'd likely need to look at subscription's first invoice -> Initial Payment Intent -> first charge -> payment_method_details
If you're not using webhooks, you can pass the CHECKOUT_SESSION_ID template variable to your front-end and then use it to retrieve the other relevant objects such as PaymentIntent and Charge
https://stripe.com/docs/payments/checkout/custom-success-page#modify-success-url
Ok if I'm not using webhooks will the charge be present upon the success url callback?
No it won't be. You'd need to retrieve the session using the Session ID first, then the PaymentIntent and then the charge object to get to payment_method_details
Ok, right but the timing will work out that I should be able to get the PaymentIntent and the charge object up the success url callback?
I just wanted to ensure the charge is created at this point in time
The charge would be created yes, but bacs_debit is an asynchronous payment method so the funds won't be available immediately.
You can read up on it here
https://stripe.com/docs/payments/bacs-debit/accept-a-payment#async