#purnendu-dash_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/1286554066519982122
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello @fluid seal
Thanks for looking into my query
The Parameter is "trial_period_days"
hello! that should be passed in when creating the subscription : https://docs.stripe.com/api/subscriptions/create#create_subscription-trial_period_days, not when creating the Price
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 not creating a subscription
I am creating a recurring price to charge like a subscription
Becasue, we need to have three things
- Sign Up Fee
- Free Trial for n days
- Recurring payment for certain periods
2 & 3 are there in subscription, but 1 is not there
To be clear, Prices do not have trial_period_days
A recurring Price is always used with a Subscription. There is no concept of trial_period_days for one off payments i.e. non-recurring Prices.
Henec We are creating a product
and adding a fixed price as signup fee
Then a recurreing price for the rest
Yes
I am setting a recurring price object only
But I cant see a way to pass trial_period_days
while creating the recurring price
To reiterate, you cannot pass trial_period_days when creating the reccuring price because there is no such parameter on a Price
trial_period_days only exist and can only be used with a Subscription
$recurring_price = Price::create([
'unit_amount' => $recurring_amount,
'currency' => $data->currency,
'recurring' => [
//'trial_period_days' => $data->customint2 / 86400,
'interval' => $interval[$data->customint4],
'interval_count' => $data->customint1,
],
'product' => $product->id,
]);
This is what I am doing now
HOwever as the param trial_period_days is there under recurring, I was trying to set
But its not accessible via set
its for return only
You can check the API doc
for your use case - you should create a Subscription with:
- a one-time sign up fee : https://docs.stripe.com/api/subscriptions/create#create_subscription-add_invoice_items,
- the trial days would be passed into this parameter : https://docs.stripe.com/api/subscriptions/create#create_subscription-trial_period_days
- pass in the recurring price here : https://docs.stripe.com/api/subscriptions/create#create_subscription-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.
The attribute is there "trial_period_days" under recurring
If you don't see the parameter in the creation API specs, then you can't pass it in during creation. What you're looking to do should be achievable with what I shared above when creating a Subscription
See, I have a few products in my site, that have the recurring payment
I was trying to create products under Stripe too
Then charge from Stripe linked products
If any update occurs in my product, I was just updating the stripe linked product too
Thats how I was managing the thing
By creating subscription, I have to create the item price object customer specific while creating the customer specific subscription
Cant I get one way out to insert data in that attribute as its already there inside the object. Not sure why you kept that but not accessible
There's some legacy reasons for why that attribute exists on the Product. I don't have full context on that since it happened some time ago. I'm afraid there's no other workaround at the moment and the only way is what I mentioned above i.e. to do it on the subscription.
In that case, I dont need to create any product on stripe
Just have to create customer specific subscriptions
You need a Product to create a Price
Why
Subscription does require a customer only
It nowhere linked with the product
right?
you can try creating a Subscription and see how it works
I am just asking for the right way of doing the thing
Also is this possible to tag someone senior here
Who may enable / give some wayout for trial_period_days parameter in price object
If its there, there might be some legacy ways too
That he / she might be aware of
I need some experts help here please
We have guides on how to create subscriptions here : https://docs.stripe.com/billing/subscriptions/integration. A recurring Price is required.
@pseudo sleet could you please have a look here
Also, there is no way to enable trial_period_days for a Price object.
I am following this way only
But cant find the way
can't find the way for?
Could you please escalate this to some seniors
trial period setup
But via dashboard you are allowing this as leacy option
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
๐ Stepping in here. I'm the senior engineer in Stripe. Stripe Dashboard uses a different setup and this legacy feature is only limited to Dashboard, but not via API. I'm afraid there is no workaround to support trial_period_days on the price object as Alex mentioned.
That means I cant create a recurring product via API
I can only setup customer specific subscriptions
yes, that's correct
Then how I can see the sales by product
To be clear, you create a recurring Price. To create a recurring Price, it needs to have a Product