#jbergius

1 messages · Page 1 of 1 (latest)

spring quailBOT
wicked roost
#

Could you share what your use case is?

narrow hawk
#

For sure.

When my users starts a monthly subscription on a specific product - I want to perform a side effect. I'll hit an external API and update some values. I also want to add my subscription in my own database (this functionality is already in place)

When this subscription updates once a month, I do NOT want to perform a side effect, only update the subscription status in my own database.

wicked roost
#

customer.subscription.created will be sent when a subscription is created and the status may be incomplete if customer authentication is required to complete the payment or if you set payment_behavior to default_incomplete.

customer.subscription.updated will be sent when the subscription is successfully started after the payment is confirmed OR whenever a subscription is changed.

#

Ultimately, it depends on what your side effect is looking for

narrow hawk
#

The only thing my side effect is looking for is to differentiate between a subscription created and subscription updated.

If I understand your answer correctly - the customer.subscription.updated is also sent when the customer activates the subscription for the first time?

wicked roost
#

It depends! customer.subscription.updated will be sent if the subscription is successfully started the payment (non-zero) is confirmed.

If the subscription is on trial (payment is 0) and payment method is not collected, it'll only be customer.subscription.created. Only when payment method is collected along with trial subscription, customer.subscription.updated will then be sent.

narrow hawk
#

Ah ok. I'm not using any trial days. So then I should be able to differentiate the two of them by checking for customer.subscription.created since that event should not be sent on subscription renewal?

wicked roost
#

Yup! Subscription renewal (recurring charges) doesn't send BOTH customer.subscription.created and customer.subscription.updated. customer.subscription.updated will only be sent when there's a change to the subscription such as downgrading/upgrading the plan, change payment method... etc

narrow hawk
#

Perfect. Thanks for your help! Have a great day!

wicked roost
narrow hawk
#

Do you know if it's possible to add metadata to your subscription when using test clock!?

wicked roost
#

Test clock is only for advancing time purpose. Subscription integration including adding metadata to the subscription remains the same

narrow hawk
#

Hmm yeah, okey. But I only seem to be able to advance time on a subscription that I created through the test clock? And in that UI I can't seem to be able to add metadata to the subscription

#

I have an active test subscription on my account (that has the correct metadata), but I can't advance time on that particular subscription. I have to create a new test subscription through the test clocks UI to be able to do that.

wicked roost
#

Yup, you can only advance the subscription created on the test clock. The UI should be able to add metadata on the subscription with test clock. I'm able to do it on my end.

#

Could you share the subscription ID (sub_xxx) on test clock that you're not able to add metadata?

narrow hawk
#

Seems like I have to create the subscription first, and then add metadata.

wicked roost
#

Yup, that's right

#

That's only if you use dashboard to create a subscription

#

If you use API to create a subscription on a test clock customer, then metadata should be attached to the subscription if it's set in creation request