#sarvesh3742
1 messages · Page 1 of 1 (latest)
Hi
we are updating subscription by keeping 'billing_cycle_anchor'=>'unchanged'
already subscribed to webhook events as follow
customer.subscription.deleted
invoice.paid
invoice.payment_failed
so in case of update subscription, can we get some different status / type of it? or same as Paid and "type": "invoice.paid" ?
or any other webhook event needs to subscribe for update subscription case?
I'm not sure I udnerstand. can you give a conrete example of what you are trying to do?
the subscriptions status are listed here: https://stripe.com/docs/api/subscriptions/object#subscription_object-status
and you can listen to customer.subscription.updated to be notified when the subscription changes
$subscription = $stripe->subscriptions->update($subscriptionData['stripe_subscription_id'],[
'items' => [[
'price' => $stripePriceId,
]],
'metadata' => $metaData,
'billing_cycle_anchor'=>'unchanged',
'payment_behavior' => 'default_incomplete',
]);
so in case of update subscription, can we get some different status / type of it? or same as Paid and "type": "invoice.paid" ?
or any other webhook event needs to subscribe for update subscription case?
or any other webhook event needs to subscribe for update subscription case?
you can listen to customer.subscription.updated to be notified when the subscription changes
invoice.paid webhook event is useful in case of subscription or need to add use "customer.subscription.created" event?
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
these are two different event.
invoice.paid is sent every time an invoice is paid. So that includes the first invoice, but also all recurring invoices.
customer.subscription.created is sent only when the subscription is created
I recommend reading this guide about subscription webhooks: https://stripe.com/docs/billing/subscriptions/webhooks
ok, got it
and how to create a test for invoice payment fail and retry for next 1 week to capture payment from customer card?
you want to test a failed payment with a Subscription?
yes
the simplest solution: create a subscription witha. short free trial (like a few seconds) and use this test card https://stripe.com/docs/testing#declined-payments
so when the trial ends, Stripe will try to charge the card, which will fail.