#bhanu365
1 messages ยท Page 1 of 1 (latest)
It sounds like you tried to set a one-time price as one of the subscription's items which is not allowed (as that error message says)
You can add one time prices in ways that get added to individual invoices but cannot set it as an item on the subscription
So basically, put your recurring subscription prices in the items list. If you have one time fees that you want on the first invoice, you can add them via the add_invoice_items param https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items
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 am using this code for the one-time but getting the same error
\Stripe\Subscription::create([
'customer' => $customer->id,
'add_invoice_items' => [[
'price' => $price_id
]],
'items' => [[
'price' => $price_id,
'quantity' => 1,
]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
]);
Can you send me the request ID from a time that you got this error? You can look at your logs at https://dashboard.stripe.com/test/logs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Or you can run that code again and print out the request ID https://stripe.com/docs/api/request_ids
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The ID will be of the form req_123
req_OW8VZCY9NKy1Kb
Thank you, checking in to that request
Ah so you included the price in both items and add_invoice_items, it should only be in add_invoice_items
And you will need at least one recurring price
Can you tell me about how you want this subscription to charge your users? Is there no recurring charge and you are you basically adding a bunch of one time fees to be charged at the end of the cycle?
We have 2 subscription 6 months and 12 months
So we're offering to clients to pay by recurring payment or they can pay one-time
They can select from the drop-down
?
That is helpful context. What happens after the six months? Does the subscription cancel, renew for another six months, or start renewing monthly?
It will renew every month, If they want to cancel then they can cancel on our dashboard but there is no way to cancel automatically.
Gotcha. In that case, I think you may find it easier to use our subscription schedules https://stripe.com/docs/billing/subscriptions/subscription-schedules
You would make a 6-month recurring price and then could tell the schedule to charge for that once and then switch to the monthly price once that first cycle is over
As I described to you I don't want to cancel the subscription after 6 months or 12 months. We just want users can pay on a monthly basis or one-time but the subscription will continue if the user pays monthly means recurring for 6 months, after 6 months it doesn't mean the subscription will be canceled. Subscriptions will continue to renew every month. If user select one time then the subscription will renew on the plan of subscription like if they choose 6 month plan with one time payment then the subscription will renew every 6 month.
๐ stepping in
So after 6 months the customer pays monthly, correct?
If they do your "one time up front for 6 months" option
yes right
Okay so then as my colleague advised above you would use the Subscription Schedule API (https://stripe.com/docs/billing/subscriptions/subscription-schedules) to start a Sub with a Price that has a 6 month billing period and then after 6 months update the Sub to a Price that has a 1 month billing period
So it can't be possible with add_invoice_items ?
You could do it with add_invoice_items if you combine that with a trial
So put the Sub on trial for 6 months and add an invoice item for the one time charge
That would work fine as well
Which price type you're referring to?
You always have to use at least one type: recurring Price with Subscriptions
I'm still confused Could you clarify what actually need to do?
First thing we're not offering free trial
Sure but if you want to create a Sub that doesn't charge Monthly for 6 months but has a Monthly Price involved then you need a trial for those first 6 months
The way you do charge the customer for those first 6 months is to add an invoice_item when you create the Sub
what is sub?
Subscription
Ok so this is the case only if we offer free trail for first 6 month right? If Yes as I said we're not offering free trial