#ZeroThreeEight
1 messages ยท Page 1 of 1 (latest)
Hi again ๐ can you elaborate a bit more? Did you run into problems while following the steps in the document provided previously, or did it not accomplish what you are looking for?
Hi yes, so I looked into the docs you sent, it was about starting checkouts with promo's and thats clear to me
But adding a discount to an existing subscription, for only the next coming cycle
For that you use this endpoint to make a request to update the Subscription, providing the ID of the Coupon you created to the coupon field:
https://stripe.com/docs/api/subscriptions/update#update_subscription-coupon
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I think I know enough then
Thanks!
One more question
Is there a way to check if someones payment is the first payment
and which webhook would that be
First payment of a Subscription? You can check the billing_reason on the Invoice that gets created. It will hvae a value of subscription_create if it's the first Invoice of a Subscription:
https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
invoice.payment_succeeded would be a good Event to catch a successful payment on an Invoice.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
invoice.payment_succeeded โ
but, billing reason will have subscription_create only the first time?
Yup, afterwards it will have other reasons, such as subscription_cycle.
You can use test clocks to move Subscriptions through their full lifecycles quickly so you see exactly what Events are generated and when:
https://stripe.com/docs/billing/testing/test-clocks
Cool, thanks
Any time!