Skip to main content

Hello,  
I am currently developing a feature that sends push notifications before the free trial expires and the subscription begins, using webhooks.

 

The logic is as follows:

if (event.type === 'INITIAL_PURCHASE' && event.period_type === 'TRIAL') {
  // Schedule push notification
} else if (event.type === 'CANCELLATION' && event.period_type === 'TRIAL') {
  // Cancel scheduled push notification
}

Will the above logic work as intended? I am curious if the `period_type` is correctly transmitted as the current subscribed product, regardless of the event type.

Be the first to reply!

Reply