#guillaume_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/1286284871014158408
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
yes you can't attach a subscription to a payment_intent
ok thanks. Could you tell me what is the flow to do so ?
Do I have to do something particular when creating the payment_intent or after ?
thank you
You can simply create a PaymentIntent with the amoun of the latest invoice
Ok. How stripe will know that this payment is related to the invoice > subscription ?
No there isn't an option.
In that case, you can use the PaymentIntent of the latest Subscription's invoice
Can you share an example Invoice Id ?
Yes that should be possible. checking the invoideId...
Yes you can use the PaymentIntent pi_3Q0dT72ERkXzKdsi0MZgqbzd of that invoice in order to accept the payment
Just to be sure:
I can reuse this pi , get the client_secret to initialize a new payment form on the front end and the payment (if it passes) will handle the stripe subscription acordingly ?
Yes I think it will pass in your use case. I invite you to make some tests.
ok I'll try, the documentation seems to indicate that payment_intent with final status (failed for instance) are not retryable.
Last thing, is there an easy way to create a user with a subscription having a failed payment on test environment ?
Last thing, is there an easy way to create a user with a subscription having a failed payment on test environment ?
First you need to create a successful Subscritpion (for example, using the card 4242) using test clock
https://docs.stripe.com/billing/testing/test-clocks
then you need to update the default payment method to this one4000000000000341:
https://docs.stripe.com/testing#international-cards:~:text=The cards in the previous table can’t be attached to a Customer object. To simulate a declined payment with a successfully attached card%2C use the next one.
and then you advance the time to the next billing cycle, so a Failure Payment will be attempted
your can continue then testing your integration
ok thanks a lot