#purnendu-dash_api

1 messages ยท Page 1 of 1 (latest)

lavish aspenBOT
#

๐Ÿ‘‹ 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.

thin bear
#

Hello @fluid seal

#

Thanks for looking into my query

#

The Parameter is "trial_period_days"

fluid seal
thin bear
#

I am not creating a subscription

#

I am creating a recurring price to charge like a subscription

#

Becasue, we need to have three things

  1. Sign Up Fee
  2. Free Trial for n days
  3. Recurring payment for certain periods
#

2 & 3 are there in subscription, but 1 is not there

fluid seal
#

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.

thin bear
#

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

fluid seal
#

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

thin bear
#

$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

fluid seal
#

for your use case - you should create a Subscription with:

thin bear
#

The attribute is there "trial_period_days" under recurring

fluid seal
#

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

thin bear
#

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

fluid seal
#

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.

thin bear
#

In that case, I dont need to create any product on stripe

#

Just have to create customer specific subscriptions

fluid seal
#

You need a Product to create a Price

thin bear
#

Why

#

Subscription does require a customer only

#

It nowhere linked with the product

#

right?

fluid seal
#

you can try creating a Subscription and see how it works

thin bear
#

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

fluid seal
thin bear
#

@pseudo sleet could you please have a look here

fluid seal
#

Also, there is no way to enable trial_period_days for a Price object.

thin bear
#

I am following this way only

#

But cant find the way

fluid seal
#

can't find the way for?

thin bear
#

Could you please escalate this to some seniors

#

trial period setup

#

But via dashboard you are allowing this as leacy option

pallid sable
#

๐Ÿ‘‹ 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.

thin bear
#

That means I cant create a recurring product via API

#

I can only setup customer specific subscriptions

fluid seal
#

yes, that's correct

thin bear
#

Then how I can see the sales by product

fluid seal
#

To be clear, you create a recurring Price. To create a recurring Price, it needs to have a Product