#Rohit89

1 messages · Page 1 of 1 (latest)

chrome turretBOT
exotic crow
#

Hi! Let me help you with this.

placid rune
#

but for recurring monthly payment, will this event initiated?

exotic crow
#

If it is created via Checkout Session - yes, but only once.

placid rune
#

yea.. what should I check for recurring monthly payment? Customer is subscribed to monthly plan..

exotic crow
#

The even is created every time a new subscription period starts, e.g. monthly.

placid rune
#

Ok. Customer.subscription.updated event is initiated every month if it is monthly subscription. ??

#

But technically the plan is not updated, so how I would know it just deducting the monthly amount not updating the subscription to another plan .... because upgrading a plan also call customer.subscription.updated

exotic crow
#

This triggers the event.

placid rune
#

Charging monthly or upgrading to new plan via portal... both initiate Customer.subscription.updated

How I would know which is upgrading a plan vs just monthly payment for existing plan?

exotic crow
placid rune
#

There is no event that would work for both one time payment via checkout session or recurring via subscription, to get details like line items, quantity?

exotic crow
placid rune
#

yeah but I would like to get when payment happens each month automatically?

#

cant we use invoice.paid response?

exotic crow
#

Yes

placid rune
#

Wether it is one time payment via checkout session or monthly via subscription --- invoice.paid this will be initiated.

#

Correct?

exotic crow
#

Yes

placid rune
#

If subscription is created I can see - "billing_reason": "subscription_create" in the invoice.paid webhook response

#

For monthly payment but will be the billing reaon?

round cypress
placid rune
#

I just checked when I do one time payment via checkout session mode: payment...

invoice.paid is not iniated.

round cypress
placid rune
#
  1. payment_intent.created
  2. payment_intent.succeeded
  3. charge.succeeded
  4. checkout.session.completed

it triggers these 4

#

if mode is subscription then invoice:paid is initiated ?

round cypress
#

Yes, always assuming the session is completed

placid rune
#

if we have 10 days trial at start of subscription, then there will be no invoice. But after 10th day invoice will be generated

#

and invoice.paid will be triggered

round cypress
#

There will still be an initial invoice and subsequent invoice.paid event in cases of a free trial

placid rune
#

let me check

#

I have checked for 10 days free trial. Subscription is created.

It initiate invoice.payment_succeeded event but not invoice.paid

round cypress
#

Can you share the sub_xxx ID?

#

I also tested it and got an invoice.paid event

placid rune
#

sub_1MRbDyLv5rdhLZWUURNkSR5A

round cypress
placid rune
#

We have following scenario.

  1. Customer can subscribed to monthly or yearly plan via checkout session.
  2. Customer can do one time payment to purchase anything

In both case which is best event that tell us if it is just subscription created or charging monthly for existing subscription or one time payment for a purchasing any asset.

placid rune
round cypress
placid rune
#

For one time , We should check checkout.session.completed and get the id of payment intent when succeeded and then list the checkout session. because checkout session will be completed even if payment is pending

#

correct?

#

if it is just subscription created or charging monthly for existing subscription
invoice.paid and use the billing_reason field to determine the cause. Correct?

#

If user upgrade the plan. Then also invoice paid?

round cypress
placid rune
#

It is card..

round cypress
placid rune
#

So we are thinking to use payment.intent.succeeded ... list the session completed in case of one time payment

round cypress
placid rune
#

Ok, When I had conversation here yesterday I have been told to payment.intent.succeeded because sometimes session is completed but payment is pending

round cypress
#

But if just cards then that'll never be the case

placid rune
#

What will be the billing reason if it charge for next month for existing subscription?

#

in invoice.paid

round cypress
#

I don't understand the question

placid rune
#

If I have monthly plan subscribed today.. what will be the billing reason when next month invoice will be paid

#

recurring payment for same subscription

round cypress
#

subscription_cycle

placid rune
#

Ok so if we sum-up our conversation.

  1. For one time payment using checkout - Use the checkout.session.completed to get all the details. If the payment is only card.
  2. For recurring payment that is created via monthly or yearly subscription. - Use the invoice.paid and check the billing_reason field to determine the cause that will be subscription_cycle
  3. If it is upgrade a plan - Use the invoice.paid and check the billing_reason field to determine the cause. billing_reason should be subscription_update.
  4. When subscription created first time - Use the customer.subscription.created or invoice.paid and check the billing_reason.
#

correct?

round cypress
#

Yep, sounds right. All of this should be easy enough to test, especially with a billing test clock

placid rune
#

billing test clock? how? any doc

round cypress