#trying-to-process-bacs-debit
1 messages ยท Page 1 of 1 (latest)
Have you looked into setting the mandate_data parameter already? Do you have a specific question?
no, how do I set the parameter?
Yes, my specific question is how can I make offline payments
It's an attribute on Setup Intents and Payment Intents. Here's the API reference for mandate_data on the Payment Intent: https://stripe.com/docs/api/payment_intents/confirm#confirm_payment_intent-mandate_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
looking...
Ok it says "This hash contains details about the Mandate to create. This parameter can only be used with confirm=true"
what is an example of what I need to enter into that parameter?
I don't understand the question. The API reference shows all the attributes and the types of values the API is expecting
I don't understand how to get mandate information to put into the param
So I just need to add the one required parameter value? "mandate_data.customer_acceptance.type": "offline"
I believe that will work. When you test it, does it have the desired effect?
I get "parameter_unknown" error
Am I writing it correclty?
"mandate_data.customer_acceptance.type"
What is the Request ID for the request you sent that gave you that error?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
you mean this one? https://dashboard.stripe.com/test/logs/req_NAOr5kwtixarlH?t=1678297129
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You have to provide the mandate_data on the Confirm API call (not the creation API call)
The API reference I sent you to is part of the Confirm Payment Intent API: https://stripe.com/docs/api/payment_intents/confirm#confirm_payment_intent-mandate_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
oh ooops, I should send it like this "mandate_data[customer_acceptance][type]"
Make sure you're using that
When I do it on create, I get this message: "Your account is not configured to allow passing mandate_data directly when confirming PaymentIntents for Bacs Direct Debits. Please see https://stripe.com/docs/payments/payment-methods/bacs-debit for more information or contact bacs-debits@stripe.com."
Did you follow the guide for setting up BACS with future payments? https://stripe.com/docs/payments/bacs-debit/save-bank-details
Which guide did you follow to set this up?
looking now
ok so it has to be a checkout? Currently I use the payment form. Is it not the same thing?
No it doesn't, I'm just trying to figure out which guide you're following and figure out why it doesn't explain how to do future payments or manage mandates
ok one sec.. I have so many guides...
That seems like a knowledge gap that our docs should address, so I'd like to update it to include a mention of these concepts if it doesn't already
ok let me pull it up.. one sec.. I have so many windows open
This is the doc I followed to submit a payment - https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
No worries. I think if you are using Payment Element, the mandate should be collected automatically, so you may be able to reference the mandate that was created on the first Payment/Setup Intent
We mention that here: https://stripe.com/docs/payments/bacs-debit/accept-a-payment
This specific section talks about mandate behavior, so I would make sure you've read this part too (in case there is some useful info about it here): https://stripe.com/docs/payments/bacs-debit/accept-a-payment?platform=web#web-post-payment-events
you mean the mandate is returned in the payload object when I make the payment intent?
or when I finish the payment (ie after the payment is submitted)?
After the Payment Intent is confirmed
yeah seems right
payment intent is confirmed when the payment is submitted?
And I get that mandate from the returned payload or do I query stripe for it?
I think I was mistaken earlier. We store mandate data on the Payment Intent for other asynchronous payment types (e.g. ACSS or Cards with mandates) but it doesn't look like that's the case for BACS.
When I create the payment intent, looks like I need to add this param: "payment_intent_data[setup_future_usage]"="off_session"
So you would have to query for it
Hmmmm, I think I might have been mistaken. I can't actually figure out how to query for the mandate. Give me a few minutes to circle back
ok sure no problem - thank you!
ugh "payment_intent_data[setup_future_usage]" does not exsist as a parameter on payment intent
So it looks like you would get the Mandate from either the Setup Intent (https://stripe.com/docs/api/setup_intents/object#setup_intent_object-mandate ) that was used to setup that Payment Method for future usage, or the Charge object (https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-bacs_debit-mandate)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'm currently not using either of those
The Payment Element would set those for you
Charges are created when a payment is created and you can get them from the Payment Intent object.
ok so I should be able to see it in the dashboard, right? Looking now...
Hi there. Taking over for two-shoes as they have to step out
You can get it via the api by going to the payment intent's latest charge: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-latest_charge
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok this is getting better
I found a mandate in the payement intent return object but when I use it, I get this error - https://dashboard.stripe.com/test/logs/req_9ERA5TnVp3mEZq?t=1678300935
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
payment_intent_mandate_invalid
Only active mandates can be used with PaymentIntents.
I want to make offline payments
as many as I'd like and keep charging a Bacs debit
seems I get a mandate after submitting a payment but then the mandate is deemed as already used and can't be used again?
If you've properly set up the payment for future usage: https://stripe.com/docs/payments/bacs-debit/save-bank-details, then you shouldn't need to pass mandate again when charging them: https://stripe.com/docs/payments/bacs-debit/save-bank-details#charge-later
I am not using check out. I am using payemnt form
I'm using this to submit payments - https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
Is there a way to get the mandate for future bacs payment in this flow?
If you pass https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage for the first payment, then you shouldn't need to pass mandate for future payments
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It's the same principle as the article I shared
Only not using Checkout
off_session if you are going to charge them off session. on_session if you are going to charge them on session. Completely depends
initial payement is on session then after that off session
my flow is that they make a their first payment then subsequently, we charget them
so is that off_session?
yep
ok trying it now...
So that will set up the underlying payment method for future usage. And you should be able to charge it offsession by doing this same thing: https://stripe.com/docs/payments/bacs-debit/save-bank-details#charge-later
I got this payment intent - https://dashboard.stripe.com/test/payments/pi_3MjSNMCZpRa6P5DM0NEHpqrN
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
it has a mandate
Ok. Now try charging it offsession in the exact same way that was done at the link I shared
I now get this error when creating a subsequent offline payment intent: "The provided mandate has a different payment method than the one provided on the PaymentIntent."
but I used the same payment method
pm_1MgvRfCZpRa6P5DM7vcOVz4L
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
oh wait - I queried the mandate and found a different payment method pm_1MjSOjCZpRa6P5DMLWyjhlkF. I used that one when making the offline payment and it worked!
But why is there a new payment method?
There isn't
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Look at the pm associated with the pi in your dashboard
Not sure what pm_1MgvRfCZpRa6P5DM7vcOVz4L is for
Looks like that one was from a week ago
pm_1MgvRfCZpRa6P5DM7vcOVz4L was the pm I used when I made teh first payment intent, the one where I say Setup Future Usage = off_session
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You created it a week ago
Oh I see what you're saying
You passed that old pm to the payment intent function
That doesn't really make sense if you're setting up a payment method for future usage
You need to be on session for the first payment to collect the user's info
So, the payment method won't really exist yet and one is created when you collect the user's payment info and set it up for future usage
ok so when I create the first payment intent with Setup Future Usage = off_session, do I not need to specify a payment method? Maybe that param is irrelevant?
I though that had to be attached to a customer
No the whole point of the checkout flow is to collect and create a pm
maybe I don't actually need to attach payment method to a customer if I'm using these mandates?
It shouldn't exist yet
You do need the pm attached, but that's the whole point of your checkout flow
So what is all this business of attaching a pm to a cus?
What do you mean?
How are you collecting payment info right now?
The attachment should happen automatically if you use the payment element
This API - {{baseUrl}}/v1/payment_methods/:payment_method/attach?customer=cus_NSJ2putWkB0jmJ
No how are you collecting payment info
What guide are you following
The payment element?
I'm collecting through stipe.js
Are you not following a guide?
so you're saying it gets attached when I go through this stripe.js flow?
my understanding was that I had to explicitly attach the pm to the customer
but I suppose I don't...
If you use the recommended flow for accepting payments in our docs (ie https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements) then attachment and PM creation happens automatically
What guide are you following?
yes, this one
but there are so many docs and every support person points me to a different one
Ok. So if you read through that guide, attachment and payment method creation isn't mentioned
That's done through the payment element automatically
ok great. So I do need to specify the customer though, right?
Yeah you just pass the customer id when creating the payment intent
But if you're passing the payment intent client secret to stripe.js to collecting payment method details, then a payment method will be created and attached to the customer automatically
ok great and then the PM is created for me. I query the PI to get the mandate and the PM for future offline payments, right?
oooh kay...
that makes total sense
Yep. And to be honest I'm not sure you need to explicitly specify the mandate. They don't here: https://stripe.com/docs/payments/bacs-debit/save-bank-details#charge-later
But recommend testing it out
I think mandate is implicitly associated with the PM if you set it up for future usage correctly so don't think you need to specify mandate for future off session payments
But again, recommend testing it to be sure
I just removed the mandate and it worked
Cool yeah
wow - so all I was missing in all of this was setup_future_usage = off_session
And shouldn't include pm_123 in the PI creation request for your flow
ooooh
I just need the customer
no mandate, no payment method
wow - it's that simple.. you guys do it all.. as long as I pass the magic setup_future_usage = off_session
does it ever expire and then I have to send the user back to the accept a payment stripe.js flow again?
Oh no, actually if I don't send the PM_ then it will debit the credit card instead of Bacs Debit
maybe because that customer paid with credit card before
and payments default to credit card..?
Sorry I think I confused you. I meant you don't need to specify the PM_ in the initial payment intent creation request (the on-session one).
For the off-session ones, you're correct
It's safest to pass pm_ for the offsession payments in case they have a card as their default
No problem. And mandate shouldn't expire or anything
Can I bug you again if I have issues?
Yeah, but we archive threads after some time, so if you have any more questions, just ask in the main channel again
No problem
You really helped unblock me. Very grateful ๐