#mathan

1 messages ยท Page 1 of 1 (latest)

tawdry currentBOT
merry mason
#

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?

unreal sonnet
#

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,

                        ],
                    ],
                ]
            );`
merry mason
unreal sonnet
#

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).

merry mason
#

alright, what do you need help with specifically?

#

the error message seems quite self explanatory

unreal sonnet
#

$stripe->subscriptionItems->createUsageRecord($subscriptionItem->id, [
'quantity' => $activeCount,
'timestamp' => now()->timestamp,
]);

#

i used this query anythiing wrong?

merry mason
#

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)

unreal sonnet
#

can i add this for usage based plan (graduated billing)

regal badger
unreal sonnet
#

yes this is

#

is any way to implement this checkout page for usage based billing?

regal badger
#

yeah, you pass the Price to Checkout, it just works. Did you see otherwise when you tried?

unreal sonnet
#

no, i did not tried

flat kiln
#

Hi! I'm taking over this thread.

#

Let met know if you have any other questions.

unreal sonnet
#

i put tha correct start and end date but its shows error?

flat kiln
#

Can you share the request ID (req_xxx)?

unreal sonnet
#

req_IrZwSjBIIlXXKi

flat kiln
#

Thanks. What exactly are you trying to do? As mentioned in the error message, you cannot edit the start date of the current phase.

unreal sonnet
#

$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?

flat kiln
#

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?

unreal sonnet
#

for example, i am already in a plan. i just going to schedule the another plan in current plans end date!

flat kiln
#

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.

unreal sonnet
#

no i dont want to change

#

i jus want schedule another plan when current plan ends(30th day)

flat kiln
unreal sonnet
#

0

#

................................................................................................................................................................................................................................................................................................

flat kiln
#

What does that mean?

unreal sonnet
#

sorry mistakenly typed

#

let me check

#

yes used that same thing

#

but error comes

flat kiln
#

Can you share the request ID (req_xxx)?

unreal sonnet
#

i already shared

unreal sonnet
flat kiln
#

Can you share the request ID (req_xxx)?

unreal sonnet
#

req_IrZwSjBIIlXXKi

#

same one , i shared above

flat kiln
#

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:

unreal sonnet
#

in this query only the quantity changed so how can i get this error?

flat kiln
#

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.

unreal sonnet
#

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?

flat kiln
#

The start_date of the first phase should not change. But you can change the end_date and add a new phase if needed.

unreal sonnet
#

yes thats i did

#

i changed the end date only

flat kiln
#

In the request you shared: the subscription schedule has a start date of 1673511247, and you are trying to change it to 1673481600.

unreal sonnet
#

yes i understand

#

great!

#

thanks for helping me ๐Ÿค

flat kiln
#

Happy to help ๐Ÿ™‚

unreal sonnet
#

thanks

#

how can i get current subscription payment status?

olive marten
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

unreal sonnet
#

how can i get current subscription payment status?

olive marten
unreal sonnet
#

okay , if the my current plan is end, i am in 31st day what is the status i will recieve?

olive marten
#

what do you mean ended?

#

do you mean you canceled the subscription?

unreal sonnet
#

No

#

i mean the end_date of subscription

#

when will this status change from active to overdue or past_due?

olive marten
#

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.

unreal sonnet
#

okay if they paid, customer.subscription_update webhook will trigger or not ?

olive marten
#

you should listen to invoice.paid

unreal sonnet
#

when user renews, i want to update the next cycle details in my product!!

olive marten
olive marten
#

let me know if you need any more help