#issambd-subscription-payment

1 messages · Page 1 of 1 (latest)

wooden totem
#

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?

little elm
#

to store the payment methods I am following this guide from docs

wooden totem
#

Actually, let me take a step back

#

When you're creating a subscription I don't think you need to attach a PaymentIntent.

little elm
#

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

wooden totem
#

Do you have the ID of a subscription that I could look at?

little elm
#

when collecting the user's card I follow those two steps : -Create a SetupIntent (backend)
-Collect payment details (frontend)

little elm
#

price_1Jmd6BLzSPzAEiPDmUdLf9BA

#

prod_KR7tHwdkGXtx1r

#

I am not sure if subscriptions have ids per se

wooden totem
#

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

little elm
#

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 ?

wooden totem
#

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)

little elm
#

alright, lemme try it out, thnak you!

wooden totem
#

Happy to help! If that doesn't work for whatever reason or you encounter errors along the way, you know where to find us 😄

little elm
#

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

wooden totem
little elm
#

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!

wooden totem
#

Glad to hear we could help!