#taviksha-akar_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/1277609716045971587
đ 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.
- taviksha-akar_api, 3 days ago, 25 messages
- taviksha-akar_api, 4 days ago, 38 messages
- taviksha-akar_api, 4 days ago, 5 messages
- taviksha-akar_api, 4 days ago, 18 messages
- taviksha-akar_api, 5 days ago, 16 messages
- taviksha-akar_api, 5 days ago, 25 messages
and 2 more
hi there!
can you clarify what is your question? do you get an error when you run your code?
my question is how to set start date of phase 2 to the 48 hours before the collection date
for example, if my colleciton date is 29 aug so set date to 48 hours ago from 29 aug to the phase 2.
in my provided code above, it is giving me this error -
"message": "`start_date` must be less than each phase's `end_date` or its derived end date based on `iterations` and `plans`."
// Phase 1: $0 amount to account for the 10% already paid
$phases[] = [
'items' => $this->setSubscriptionCreateItems($requestData['products'], 0)['recurringItems'], // Set items with $0 price
'billing_cycle_anchor' => 'phase_start',
'proration_behavior' => 'none',
// 'iterations' => $daysBeforePhase2, // Only 1 iteration for this phase
'end_date' => strtotime($requestData['collection_date']) - 48 * 3600,
];
// Phase 2: 90% remaining amount, starts 48 hours before the collection date
$phases[] = [
'items' => $this->setSubscriptionCreateItems($requestData['products'], 90)['recurringItems'], // Set items with 90% of the amount
'billing_cycle_anchor' => 'phase_start',
'proration_behavior' => 'none',
'iterations' => 1, // Only 1 iteration for this phase
];
// Phase 3: Regular pricing for all subsequent iterations
$phases[] = [
'items' => $items,
'add_invoice_items' => $charges,
'billing_cycle_anchor' => 'phase_start',
'description' => $requestData['description'] ?? null,
'proration_behavior' => 'none'
'discounts' => $requestData['coupon_id'] ?? [],
'iterations' => 2
];
// Conditional phase for 25% discount after 3 iterations
if ($twentyFivePercentDiscount) {
$phases[] = [
'items' => $items, // Set items with 25% discount
'billing_cycle_anchor' => 'phase_start',
'discounts' => [
['coupon' => config('coupon-constants.twenty_five_percent_coupon')],
]
];
}
can you share the request ID (req_xxx)? you can find it here https://dashboard.stripe.com/test/logs
req_IBIifgj8NcpqAC
thanks! give me a few minutes to look into this.
ok thanks
you set start_date: 2024-08-28 for the Subscription, and end_date: "2024-08-26" for the first phase. that doesn't make any sense, so it's expected to return an error. how can the first phase start before the beginning of the subscription?
Actually in my case, I want to set a phase with start date to 48 hours less than collection date. So if collection date is 29 aug then payment should be done before 48 hours.
I am doing it with one more case, I need to take 10% for the initial invoice then in second phase that I have mentioned 48 hours before collection date so on this date remaining 90% payment.
So as suggested by your team previously-
he Subscription Schedule can look like :
phase 1 : $0 price to take into account the 10% that was already paid
phase 2 : 90% remaining amount (start date will be 48 hours before col. date)
phase 3 : regular pricing
phase 4: 25% discount if applicable after 3 months
so how can i set 90% payment start date.
For this I tried it by setting end date to 2024-08-26 so that next phase i.e second phase should start after this
and 90% payment will be set according to by 48 hours condition
that's why i was trying like that
can you please suggest me how can i do this. I am trying it from a long time
there?
I think what you are missing from that suggestion is the phase 1 with the $0 price. From your description it sounds like you are taking payment and then should create a schedule that charges $0 for 48 hours and then changes to the next phase which has an actual chargable price
In phase 1, I am setting the unit_amount to 0. and iterations to 1 but how can i schedule the 90% payment to any partcular date, start_date is not there to pass for particular phase. I am taking 10% using one off and if that success then creating subscripion
???
You can either do that by creating a one time 10% coupon and adding that to the second phase, or you can create a credit note on the customer equal to the amount that they paid after they pay that 10%.
https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-phases-coupon
https://docs.stripe.com/api/credit_notes
You can either do that by creating a one time 10% coupon and adding that to the second phase -> I need to take payment on particular date? how to set start date
Apologies for missing that question. Phases each have an end_date so you can define the end date of the previous phase to be the time that you want this new phase to start https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-phases-end_date
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes but as discussed this earlier, I want to set a phase with start date to 48 hours less than collection date. So if collection date is 29 aug then payment should be done before 48 hours.
so the collectio n date is 29 aug and phase 1 end date is 26 aug which will return error that end date cannot be less then start date. so how to set phase 2 date based on 48 hours condition.
You will want to define phase 1 as starting on 26 aug and ending on 29 aug. Then phase 2 will start on 29 aug and you can define the next end date from there
No, this is not what I need.
i need to take 90% payment before 48 hours of collection date
Can you lay out for me a quick timeline of what you would want these payments to look like for a $10 subscription?
so according to $10, i want to take 10% of it immediately then if collection date is 29th aug then set phase start date to 48 hours before 29th aug to take remaining 90% payment of $10 then set phases for regular pricing
Unfortunately I am still not clear on what I got wrong before. Can you lay out a timeline in chronological order with exact amounts starting on Aug 1?
Like when is the $1 being paid, when is the $9 being paid, etc
Aug 1 -> $1 will be paid immediately and then checking the collection date set phase start date to 48 hours before collection date and set amount $9 to pay
so if its future date then set phase date
and if not future then charge
What I am currently confused on is that you said that my suggestion would not work because
i need to take 90% payment before 48 hours of collection date
But in your example you just said that the 48 hours comes before the $9 payment
So are you saying Aug 1 take a $1 payment and then Aug 3 take a $9 payment? Or something else?