#H Panseriya

1 messages ยท Page 1 of 1 (latest)

wide mortarBOT
dark lichen
#

Hi there ๐Ÿ‘‹ which part of that flow are you running into problems implementing that you're looking for assistance with?

full beacon
#
  • How to deduct the amount from the backup card instead of the default card when a payment fails for subscription model?
dark lichen
#

If you want to trigger those fallback payments from your code, then you'll trigger a request to try to confirm the failed Payment Intent but provide the ID of the fallback Payment Method that you would like to use.
https://stripe.com/docs/api/payment_intents/confirm

https://stripe.com/docs/billing/subscriptions/overview#build-your-own-handling-for-recurring-charge-failures

Learn how subscriptions work within Stripe.

full beacon
#

In which API need to put the ID of stripe card to deduct amount for subscription?

dark lichen
#

The request to confirm the Payment Intent, the one that I provided a link for.

full beacon
#

Then how does payment intent relate to the subscription?

We also want to know from which card stripe has deducted the amount.

dark lichen
#

Every billing period a Subscription creates an Invoice, and each Invoice will create a Payment Intent to process the payment for that invoice, so Subscriptions still use Payment Intents to handle their payments.

Payment Intents also have a payment_method field to track the ID of the Payment Method that it used:
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method

full beacon
#

Ok. Thanks. Let me take a look and get back to you.

#

@dark lichen
One another use case.

  • Let's consider the above use case solved.

  • Now, we want to deduct the subscription amount from the default card When the next renewal happens.

  • For next renewal, From which card stripe will deduct the amount for active subscription?

dark lichen
#

That depends on how you set the default payment method fields on the Subscription and Customer objects. We will try to use the payment method specified in the default_payment_method field on the Subscription, but if no payment method was specified there then we will fall back to other fields. You can see the exact fields that we fall back on, and in what order, in the description of this field:
https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method

full beacon
dark lichen
#

If you want the renewal to automatically charge a card other than the one currently set as the default, then you will need to update the default before the Subscription renewal occurs.

If the typical renewal payment fails, and you want to retry with a different card, that is when you confirm the Payment Intent and provide the ID of the backup Payment Method that you want to use.

full beacon
#

Ok. Tomorrow, I will try and update you.

dark lichen
#

Sounds good!