#mathan
1 messages ยท Page 1 of 1 (latest)
hello, can you share what you're trying to do?
like what the error message mentions, you can't modify the start date of the current phase
why are you trying to modify the start date of the current phase?
No i jus schedule tha next phase like this
this is my code
` $stripe->subscriptionSchedules->update(
$subscriptionSchedule->id,
[
'phases' => [
[
'items' => [
[
'price' => $this->model->subscriptionPlan->stripe_id,
],
],
'start_date' => strtotime($subscriptionPLanLogs->start_date),
'end_date' => strtotime(now()->addMinutes(3)),
],
[
'items' => [
[
'price' => $this->plan->stripe_id,
],
],
'iterations' => 1,
],
],
]
);`
can you share the request id [0]? it'd look like req_xxx
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
i solved this
thanks, i just added the wrong start_date in this query
i found this error in create usage record
Cannot create the usage record with this timestamp because timestamps must be after the subscription's last invoice period (or current period start time).
alright, what do you need help with specifically?
the error message seems quite self explanatory
$stripe->subscriptionItems->createUsageRecord($subscriptionItem->id, [
'quantity' => $activeCount,
'timestamp' => now()->timestamp,
]);
i used this query anythiing wrong?
have you checked the Subscription (related to the Subscription Schedule) - when is the current period?
like what the error message says, the timestamp of the usageRecord must be after the subscription's last invoice period (or current period start time)
can i add this for usage based plan (graduated billing)
seems like it, the example code at https://stripe.com/docs/products-prices/pricing-models#graduated-pricing is creating a usage-based Price with graduated tiering.
yeah, you pass the Price to Checkout, it just works. Did you see otherwise when you tried?
no, i did not tried
this error comes again, when try to schedule a update, but i give correct start date
i put tha correct start and end date but its shows error?
Can you share the request ID (req_xxx)?
req_IrZwSjBIIlXXKi
Thanks. What exactly are you trying to do? As mentioned in the error message, you cannot edit the start date of the current phase.
$stripe->subscriptionSchedules->update(
$subscriptionSchedule->id,
[
'phases' => [
[
'items' => [
[
'price' => $this->model->subscriptionPlan->stripe_id,
],
],
'start_date' => strtotime($subscriptionPLanLogs->start_date),
'end_date' => strtotime(now()->addMinutes(3)),
],
[
'items' => [
[
'price' => $this->plan->stripe_id,
],
],
'iterations' => 1,
],
],
]
);
this my code to schedule tha subscription when current plan ends, is anything wrong?
this my code to schedule tha subscription when current plan ends, is anything wrong?
I'm not sure I understand. Can you explain in more details what you are trying to do here exactly? What's your end goal?
for example, i am already in a plan. i just going to schedule the another plan in current plans end date!
Got it. If you want to change the plan of an existing subscription schedule, then you need to keep the existing start_date. In the request you shared, you changed the start date.
Another option would be to add a second phase to the schedule.
no i dont want to change
i jus want schedule another plan when current plan ends(30th day)
i jus want schedule another plan when current plan ends(30th day)
Right now your code is trying to change the existing first phase of the schedule. What you want to do instead is to add a new phase to the schedule. You can see an example of this here: https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating:~:text=To add additional phases to a subscription schedule%2C pass in the current phase%2C and then define your new phases%3A
0
................................................................................................................................................................................................................................................................................................
What does that mean?
Can you share the request ID (req_xxx)?
i already shared
i used this same code and i got error
Can you share the request ID (req_xxx)?
Have you read my previous message? Your code is wrong, so it's expected there is an error. You need to change you code to something like this:
in this query only the quantity changed so how can i get this error?
The subscription schedule has a start date of 1673511247, and you are trying to change it to 1673481600. Which, like I said, is not possible.
If you want something to happen in the future, you need to add a new phase to your schedule.
So it means you code should contain two phases:
- the existing phase
- the new phase
See the screenshot above for an example of this.
okay i cannot change the start_date and end in this query i need to put current phase start and end dates from stripe right?
The start_date of the first phase should not change. But you can change the end_date and add a new phase if needed.
In the request you shared: the subscription schedule has a start date of 1673511247, and you are trying to change it to 1673481600.
Happy to help ๐
๐ taking over for my colleague. Let me catch up.
how can i get current subscription payment status?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay , if the my current plan is end, i am in 31st day what is the status i will recieve?
No
i mean the end_date of subscription
when will this status change from active to overdue or past_due?
from the link I sent you earlier
If subscription collection_method=charge_automatically it becomes past_due when payment to renew it fails and canceled or unpaid (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.
If subscription collection_method=send_invoice it becomes past_due when its invoice is not paid by the due date, and canceled or unpaid if it is still not paid by an additional deadline after that. Note that when a subscription has a status of unpaid, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
okay if they paid, customer.subscription_update webhook will trigger or not ?
you should listen to invoice.paid
when user renews, i want to update the next cycle details in my product!!
would you mind reading through that doc?
Specifically this section https://stripe.com/docs/billing/subscriptions/webhooks#active-subscriptions
let me know if you need any more help