#issambd-subscription-payment
1 messages · Page 1 of 1 (latest)
Hey 👋 pulling your other message for context
just for more clarification, I am trying to implement a paymenet workflow where the customer saves their payment method and chooses to pay later without having to give the payement infos again
If you're intending to collect these payment methods for future use, are you using a SetupIntent to store the information and prep it for future use?
to store the payment methods I am following this guide from docs
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Actually, let me take a step back
When you're creating a subscription I don't think you need to attach a PaymentIntent.
you are right, after creating the subscription the backend sends SubscriptionId and ClientSecret to thr front end where the user enters their billing datails and the subscription is finalized. I want to implement this whole process on the backend side
after the subscription is created the payment is incomplete until the user enters their billing details, now I have aleady collected the user's billing infos and want to finalize the process on the backend side
Do you have the ID of a subscription that I could look at?
when collecting the user's card I follow those two steps : -Create a SetupIntent (backend)
-Collect payment details (frontend)
I do have an ID, it's a test product however
price_1Jmd6BLzSPzAEiPDmUdLf9BA
prod_KR7tHwdkGXtx1r
I am not sure if subscriptions have ids per se
Ah, if you're creating the SetupIntent, then I'm fairly certain you can just create the subscription against the desired customer. If you want to use a payment method other than the one they already have attached to them then you could pass in a default_payment_method. But if you don't:
ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer’s invoice_settings.default_payment_method or default_source.
https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
does this mean that passing the already collected paymenet method in the default_payment_method property finalizes the subscriptions and the transaction is marked as complete without having ti create any other paymentIntent ?
It means you don't have to create the PaymentIntents. They'll still be created, just behind the scenes, which is the same behavior that will occur each time the customer needs to be invoiced (weekly, monthly, yearly, whatever your billing frequency is set to)
alright, lemme try it out, thnak you!
Happy to help! If that doesn't work for whatever reason or you encounter errors along the way, you know where to find us 😄
I'm sorry, I still have an issue. The payment method is registered this time to the payment, the payment however is still marked as incomplete and the invoice is still unpaid. any idea what could be the problem here?
I'm suspecting the issue has to do with this property passed to the subscriptionOptions : PaymentBehavior = "default_incomplete"
and from the dashboard I can see this : PaymentIntent status: requires_confirmation
Ah, good catch! With PaymentBehavior being set to default_incomplete you'll need to explicitly confirm the first Payment Intent that is created:
https://stripe.com/docs/api/payment_intents/confirm
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes, you are correct. It was solved after adding code to confirm the PaymentIntent generated by the subscription object
I very much appreciate the help!
Glad to hear we could help!