#nathanahoy_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1471274157600805054
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
The steps taken to render the payment element are as follows:
- First create a customer session with the stripe customer id (only if we have previous created a stripe customer), to display saved payment methods if available
- We then render a
@stripe/react-stripe-jsElements component with the optional customer session - Inside the Element component, we render a
@stripe/react-stripe-jsPaymentElement - In the on submit function for the PaymentElement, we create a setup intent (creating a new stripe customer at this point if one does not exist) for teh customer, then with the returned setup intent client secret, we call stripe.confirmSetup() from useStripe()
- There is a webhook listener for the
payment_method.attachedevent that will set the newly added payment method id as theinvoice_settings.default_payment_methodid (to ensure the method can be used to pay for invoices) - If that succeeds, we then call our start subscriptions endpoint, that creates a new subscription using the customer id (this subscription contains 2 prices, one Usage-based and one fixed price)
While testing I've been unable to get the acss_debit payment method type working, even if I explicitly set it for the create setup intent call. Just wondering if you had any guidance on how to use both credit cards and acss_debit in this type of flow. Also if any further clarification is required please let me us know.
Hi there. So you're rendering the Payment Element without a client secret from a SetupIntent, correct?
Yes, we are using the client secret from the customer session
That flow just isn't supported for ACSS debit, unfortunately: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup#enable-payment-methods
What would be the recommended flow?
Client is very keen to use Canadian Pre-Authorised Debits
You need to create a SetupIntent first and then send its client secret back to the frontend and use it to render the Payment Element. This guide, essentially: https://docs.stripe.com/payments/acss-debit/set-up-payment?payment-ui=direct-api
Which used to be the only way to do it / was the default integration until a couple of years ago