#ceducharme_api

1 messages · Page 1 of 1 (latest)

visual nacelleBOT
#

đź‘‹ Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1414946678884270183

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

oak temple
#

hi there!

warped cape
#

Hi, let me know if you need more details or code sample of how I create payment methods and/or subscriptions!

oak temple
#

what's your payment flow exactly to create the bank PaymentMethod?

warped cape
#

User clicks Add Pre-authorized Debit that triggers creating a setup intent on the server to get client_secret and then open a modal with stripe PaymentElement component in it.

Creating the setupIntent with the following params: {
customer,
usage: "off_session",
payment_method_types: [ "acss_debit"],
payment_method_options: {
acss_debit: {
currency: "cad",
mandate_options: {
payment_schedule: "combined",
transaction_type: "business",
interval_description: "when issued invoices become due | quand les factures émises arrivent à échéance",
}
},
}

#

Then user fills the form and clicks Continue which triggers stripe.confirmSetup on the client

oak temple
#

so you are first creating a SetupIntent, and then using the Payment Element to collect the payment method details?

warped cape
#

Yes exactly that for bank accounts only since client_secret is required before hand when using PaymentElement, when adding a credit card I create the setup intent only after user submits the form to prevent creating customers that might never be ones.

#

When I look at the bank payment method created and attached to the customer the mandate is there and seems to be valid to be used for off_session payment confirmation

oak temple
#

which payment method are you looking at exactly? pm_1S1XkFFOEj3lF4AUYamsUt1u?

warped cape
#

Yes pm_1S1XkFFOEj3lF4AUYamsUt1u

#

In the dashboard the mandate Id is there and was created with the proper mandate options

oak temple
#

could you create a new SetupIntent/PaymentMethod, without that error?

warped cape
#

Yes give me a minute, I'll send the details

#

req_kL4LCXEy43zfaq

oak temple
#

now can you collect the payment method

#

and then try starting a subscription with that new PaymentMethod?

visual nacelleBOT
warped cape
#

Just did that, the payment intent on the invoice is in requires_confirmation status, so it did not confirmed it automatically

frigid canopy
#

Hey there, taking over for @oak temple as they needed to step away. Looking into this now

warped cape
#

Good, let me know if you have any questions

frigid canopy
#

Sorry, lots of active threads right now, still looking things over

frigid canopy
#

Looking at req_2F69UJrL0n5Px3 where you made the POST /v1/payment_intents/:id/confirm request, you can add the parameter off_sessoin set to true, since you're doing this server side

Set to true to indicate that the customer isn’t in your checkout flow during this payment attempt and can’t authenticate. Use this parameter in scenarios where you collect card details and charge them later.

https://docs.stripe.com/api/payment_intents/confirm?api-version=2025-08-27.preview&rds=1#confirm_payment_intent-off_session

Can you check to see if this works?

warped cape
#

When I'm creating the subscription I set the off_session to true. That was an attemp trying to confirm payment intent after creating the subscription, but I don't think it's the way since it's pretty hacky (extracting the payment intent id from the client secret). I've commented that part in my code to let billing handle it as it should, I could make a simpler confirmation that doesn't try to set the mandate and just confirm without any options if you think It could work. The problem seems to be more with the way the payment intent is automatically created, since it doesn't seem to be aware theres a mandate on the payment method it's trying to use

visual nacelleBOT
frigid canopy
#

Got it. Looking at this subscription creation request req_PGzlAGWAKyBe3V, you are using payment_behavior: "default_incomplete". This is unnecessary, because you already have the customer and payment method setup as the default. If you remove this parameter, it should work for your use case

warped cape
#

Just tried it, now I get payment failed event on the invoice and payment intent is still in requires_confirmation status

bronze venture
#

Can you provide the Request ID?