#imheretolearnbro_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1293601810883285033
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- imheretolearnbro_api, 16 hours ago, 30 messages
Hello! Can you give me an example Event ID so we can talk about a specific scenario?
When someone cacels a subscription these are the values from the "previous_attributes"
previous_attributes {
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": null,
"cancellation_details": {
"reason": null
}
}
When someone renews a subscription these are the values from the "previous_attributes"
previous_attributes {
"cancel_at": 1731107853,
"cancel_at_period_end": true,
"canceled_at": 1728490015,
"cancellation_details": {
"reason": "cancellation_requested"
}
}
An Example Event ID - evt_1Q82RIA4iGWI69G8KKvuIywq
It sounds like you're able to tell the difference between the two. What's your specific issue and how can I help?
Right now I'm just checking for the following
if not previous_attributes.get('cancel_at_period_end'):
# Logic for "Cancel plan"
if previous_attributes.get('cancel_at_period_end'):
# Logic for "Renew plan"
Is this correct?
I can't tell you if that's correct or not for your use case and specific needs because I don't have enough context. Typically what you want to do is compare the value on the object with the corresponding value in previous_attributes. With booleans like cancel_at_period_end you don't have to compare, because they can only be true or false, so what you have might suffice. The main question to ask is if, in your system, are there any conditions where cancel_at_period_end will change that aren't a result of a cancel or renewal?
Like will your system ever change that value for any other reason?
Yeah thats the thing I wan't to know whats the exact implementation of this
It's your impelmentation. ๐
So I can just copy/paste the logic everyone uses to handle "Cancel plan" and "Renew plan"
And obviously change up the specifics
There is no "logic everyone uses". Everyone uses different logic tailored to how the system they built works.
Just the logic to differentiate the two thats all
If the only thing that will ever change cancel_at_period_end is the Customer Portal in your integration then what you have is probably fine, I'm just trying to make sure you consider all the possibilities.
You have full context on your integration, I don't.
I figured out the error. When a customer successfully pays a subscription its not like 1 event is triggered it a ton
Thats whats creating the error
What error?