#brookflok_webhooks

1 messages · Page 1 of 1 (latest)

cyan starBOT
real hingeBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

cyan starBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1240413454431424623

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

hollow oar
#

So I have an app with subscription and it has packages

#

The user can change the package, the can upgrade and downgrade

#

when he downgrades, his downgrade will hapen when the current subscription ends

#

And I can do that with subscription schedules

spare oak
#

I think there might be a fundamental misunderstanding here. No new subscription is created during normal downgrades/upgrades

#

Where are you checking the invoice_billing_reason ?

hollow oar
#

Okay, so I will explain it to you

#

just a second

#

Didn't have the space in the Question

#

So I have 3 packages for the users and they can be monhly and yearly so basically I have 6 packages.

And the user can subscribe to a yearly package and he can chose to downgrade to a monthly plan.

He will first use his yearly package, and then downgrade to the monthly payment.

#

To achieve this I take the subscription and put it to { cancel_at_period_end: true }

#

and then schedule a new subscription that will start when this subscription ends

#

I will be able to track when the old subscription ends with subscription_schedule.canceled

#

then I will be able to track the new subscription with

#

subscription_schedule.released

#

and then the user will have to pay for the new released subscription

#

and then it will trigger invoice.paid

#

invoce data.object contains $invoice->billing_reason;

#

and when I have a new subscription it is subscription_create

#

but when I make a new cycle payment

#

it is subscription_cycle

#

Now I'm interested what biling_reason will it be in this case, so I can update my user when he pays for the subscription

spare oak
hollow oar
#

Okay, but what would be the aproach to this maybe without the billing_reason

#

I was thinking when subscription_schedule.released happens that the user paid for the subscription

#

but it doesn’t say it anywhere so I asume it is not

#

So I guess the only way to know did the user pay is to get the webhook for the payment

spare oak
#

I'm not sure I understand the question

hollow oar
#

So you understand the billing_reason idea?

#

I ask you if there is some other way how to track that the user has paid for the new subscription that was scheduled

spare oak
#

You could listen for invoice.paid webhook Events. That's usually how people check the status of a Subscription payment

hollow oar
#

Yes, but I have diferent cases, that I check with billing_reason but because you don't know that, I was thinking maybe there is some other way to know for the scheduled subscription payment

spare oak
#

Not really. Webhooks are the recommended path to success for that

hollow oar
#

As you can se I use them

#

and I get the billing_reason from the $invoice

#

Just have it setup for subscription_create, subscription_cycle, subscription_update and wanted to set the new subscription before it

#

and was asking is there some way I can know that it is a scheduled subscription that was released

spare oak
#

I'm sorry, it's really difficult to understand what you're actually asking

hollow oar
#

It is okay, I think I figured it out

#

thx for the help 😄

spare oak
#

Sorry I couldn't be more helpful! Best of luck all the same

hollow oar
#

No, you were totaly okay

#

I understand that it is a complext thing, that I should work around