#neil-subscription

1 messages · Page 1 of 1 (latest)

whole sage
#

👋 happy to help

olive cliff
#

Thanks! I guess the question boils down to "how do i confirm payment of a subscription using an existing payment method?"

whole sage
#

is your subscription's collection_method set to automatically_charge?

olive cliff
#

let me see

whole sage
olive cliff
#

Yeah subscription is set to the default charge_automatically

#

And yes i do have the subscription id

whole sage
#

would be great if you could share it please

olive cliff
#

oh i'm sorry, i'm just in my test environment

whole sage
#

when the subscription is set to automatically charge the payment method, there's no need for you to confirm the payment intent

whole sage
olive cliff
#

Use stripe.confirmPayment to complete the payment using details from the Payment Element and activate the subscription. This creates a PaymentMethod and confirms the incomplete Subscription’s first PaymentIntent, causing a charge to be made. If Strong Customer Authentication (SCA) is required for the payment, the Payment Element handles the authentication process before confirming the PaymentIntent.

whole sage
#

this is in the case where you're not passing a default_payment_method

olive cliff
#

i see! thank you!

whole sage
#

basically for paying an invoice we look for the following defaults, in the following order, and use the first one we come across (as long as it’s compatible with the Subscription/Invoice):

  • The Invoice’s default_payment_method
  • The Invoice’s default_source
  • The Subscription’s default_payment_method
  • The Subscription’s default_source
  • The Customer’s invoice_settings.default_payment_method
  • The Customer’s default_source
#

if none of those are set, then you could get the latest_invoice.payment_intent.client_secret and pass it to the Stripe Elements on the front-end to gather the payment info

#

so when you create the Subscription you can expand on latest_invoice.payment_intent to get the client_secret

olive cliff
#

Got it. Great summary, thank you

whole sage
#

last thing to add

#

and this will make the upcoming invoices use that same payment method

#

I think I covered it all now 🙈

olive cliff
#

ok perfect. I appreciate the help