#ludvig-invoice-upcoming

1 messages · Page 1 of 1 (latest)

radiant hull
#

ludvig-invoice-upcoming

hasty temple
#

Awesome thx

#

How do I wait 1 week before canceling a subscription if the payment fails?
I'm listening to invoice.payment_failed and I want the customer to be able to update their payment method before we cancel their subscription.

radiant hull
#

you'll have to track that on your end, and cancel the Subscription manually after 1 week from payment failing (if the latest Invoice is still unpaid)

hasty temple
#

Ok, what should my settings be here then?

radiant hull
#

the way you want to do it, you want to set the number of retries (so you get retries over 7 days) and then set it to cancel after the last retry fails

hasty temple
#

Okay so I can send a reminder when invoice.payment_failed triggers and then retry for 7 days.
Then when all the retries fail the subscription will cancel (by activating that) and then I can listen on customer.subscription.deleted?

radiant hull
#

yes

hasty temple
#

Awesome. One more question.

radiant hull
#

sure

hasty temple
#

This code-snippet creates a checkout.stripe.com/pay link.
When the customer updates their billing details here, will it automatically update their default subscription payment method?

    $session = $stripe->checkout->sessions->create([
      'cancel_url' => 'https://swingtrejdarna.se',
      'success_url' => 'https://swingtrejdarna.se',
      'mode' => 'setup',
      'payment_method_types' => ['card'],
      'customer' => $object['customer'],
      'metadata' => ['event' => 'invoice.payment_failed', 'pi_id' => $pi['id']]
    ]);
#

Or do I need to listen on checkout.session.completed and update the payment_method of the customer to the new?

radiant hull
#

will it automatically update their default subscription payment method?
no, you'll have to do that in a separate request, that CheckoutSession will just attach the PaymentMethod to the Customer

hasty temple
#

Ok, what is that request called?

radiant hull