#ludvig-invoice-upcoming
1 messages · Page 1 of 1 (latest)
hello, you're looking for invoice.upcoming https://stripe.com/docs/api/events/types#event_types-invoice.upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ludvig-invoice-upcoming
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.
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)
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
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?
yes
Awesome. One more question.
sure
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?
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
Ok, what is that request called?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.