#developer.designer
1 messages · Page 1 of 1 (latest)
If the price is set to yearly price, then it will only show the charged time period on one year basis and it can't be broken down to two line items for two different periods
Are you able to check this?
https://dashboard.stripe.com/test/subscriptions/sub_1N9jhVBn72Zx8mpCeakkmAFq
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Can you please let me know it is correct or not?
From https://dashboard.stripe.com/test/subscriptions/sub_1N9jhVBn72Zx8mpCeakkmAFq, I only see the subscription was subscribed to one year plan
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
How can I make that as per the user selection?
like if user select 2 then it will be subscribed for 2 years.
Hi @severe pewter I'm taking over this thread
Sure please
https://stripe.com/docs/api/prices/create?lang=dotnet#create_price-recurring you should create another price with interval set to year and interval_count set to 2, and use this price to bill your customer once every 2 years.
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 have already price_id form the stripe product. with that this a causing any issue?
What's the price ID?
Here it is
https://prnt.sc/UovYW78ZqryM
Sorry, the maximum billing period is one year, so what I mentioned earlier doesn't work.
so how can I fix that for the 2 years? with recurring payments
I don't have a solution at this moment. Can you reach out to Stripe support and see if they have other suggestions? https://support.stripe.com/contact/email
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
As simple I have a product price of $240. I have selected the 2 years so recurring payment work like 1st year $120 and 2nd year $120. and want the 2-year subscription. is that possible?
Just to clarify, it's still a yearly subscription, it's just that you want it to be automatically cancelled after 2 years, am I right?
yes, correct and I need to show into the invoice that like it's 2 years subscription.
You can use subscription schedule to automate it https://stripe.com/docs/api/subscription_schedules/create?lang=dotnet#create_subscription_schedule, so you just need to add one phase with the yearly price and set the iterations to 2, and also set end_behaviour to cancel so that the subscription will be canceled in 2 years.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
About the invoices, Stripe will generate the invoice upon renewal, so your customer will receive first invoice upon subscription, and 2nd invoice 1 year later
Are you able to update my code?
I'm afraid that I can't write code for you. I'd suggest you to take a look at the API reference that I sent earlier. the API doc provides example code.
sure, let me try that and get back to you
Can you please check is this correct now?
https://dashboard.stripe.com/test/subscription_schedules/sub_sched_1NAQIABn72Zx8mpC0ASa3Ahf
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You set iterations to 3, so you want to create a 3-year subscription instead of 2-year?
Yes, it looks good to me.
okay but when I try with the monthly price then in the iterations I need to set months?
https://dashboard.stripe.com/test/subscription_schedules/sub_sched_1NAQO8Bn72Zx8mpCiwjnyx0p
see this it's showing only 3 months. I've selected 3 years
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You mean monthly subscription for 3 years? if so the iteractions should be 36
okay noted. and can you please let me know how can I add the metadata to it?
I'm trying like this right now but it's not visible
$subscription = $stripe->subscriptionSchedules->create([
'customer' => $customer->id,
'start_date' => $start_dates,
'end_behavior' => 'cancel',
'phases' => [
[
'items' => [
[
'price' => $price_id,
'quantity' => $quantity,
],
],
'metadata' => [
'payment_splits' => $payment_total_splits,
'price' => $price_id,
'quantity' => $quantity,
'maintenance_period' => $maintenance_period,
'num_years' => $num_years,
],
'iterations' => (int)$payment_splits,
],
],
]);
Metadata on a schedule’s phase will update the underlying subscription’s metadata when the phase is entered.
Did you check the subscription's metadata?
Yes in the subscription that works but with this it's not work. can you please check both code and let me know where I need to put?
Old code works with meta data
\Stripe\Subscription::create([
'customer' => $customer->id,
'items' => [
[
'price' => $price_id,
'quantity' => $quantity,
],
],
'collection_method' => 'charge_automatically',
'trial_period_days' => $trial_days,
'proration_behavior' => 'none',
'payment_behavior' => 'default_incomplete',
'expand' => ['latest_invoice.payment_intent'],
'metadata' => [
'payment_splits' => $payment_total_splits,
'price' => $price_id,
'quantity' => $quantity,
'maintenance_period' => $maintenance_period,
'num_years' => $num_years,
],
])
New code works but not showing metadata
$stripe->subscriptionSchedules->create([
'customer' => $customer->id,
'start_date' => $start_dates,
'end_behavior' => 'cancel',
'phases' => [
[
'items' => [
[
'price' => $price_id,
'quantity' => $quantity,
],
],
'metadata' => [
'payment_splits' => $payment_total_splits,
'price' => $price_id,
'quantity' => $quantity,
'maintenance_period' => $maintenance_period,
'num_years' => $num_years,
],
'iterations' => (int)$payment_splits,
],
],
])
What do you mean by "doesn't work" ?
Meta data not visible with new code
Check this https://dashboard.stripe.com/test/subscription_schedules/sub_sched_1NAQkABn72Zx8mpCL0dDhOVq
Not showing any metadata
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
The metadata is set on the phase, i'll be applied to the subscription object that schedule would create, not on the subscription schedule itself.
If you want to set a metadata on the subscription schedule object, set it on https://stripe.com/docs/api/subscription_schedules/object?lang=dotnet#subscription_schedule_object-metadata
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
Also I'm getting this error
parameter_invalid_integer - start_date
Invalid integer: false
When I'm trying to add a start date like this 2024-03-15
with 2023 it's works fine
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hello @tacit cliff , Are you still with me?
Hi, discord is busy, I'm be with you shortly
problem is here -> start_date: "false", you should put a timestamp value here.
I'm using this
$start_dates = strtotime($jsonObj->start_date);
$jsonObj->start_date is
"2024-03-15"
you might want to do an echo $start_dates in your php code and see its value. Based on the request log, the value of $start_dates is "false"
Based on the doc https://www.php.net/manual/en/function.strtotime.php, strtotime would return false if parsing is unsuccessful.
this is solved.
but still metadata not showing, I've tried same code which you shared with me
request ID?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
https://dashboard.stripe.com/test/logs/req_oJdJVu0yOljxJk I can see that you have successfully set a metadata
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
but it's not showing on this page.
Before that is showing
https://dashboard.stripe.com/test/subscription_schedules/sub_sched_1NARSLBn72Zx8mpCVhG1gTNO
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hmm, I don't think the subscription schedule Dashboard shows the metadata
Can you please check that if is possible or not?
I've checked, the metadata is set successfully, it's just that the metadata is not displayed in the Dashboard.
Is that possible to display?
You can always use API to retrieve the subscription schedule object and check its metadata.
Thanks for the feedback, can I suggest you to reach out to Stripe support and let them know about your feature request? https://support.stripe.com/contact/email
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.