#sarvesh3742_api

1 messages ¡ Page 1 of 1 (latest)

graceful flameBOT
#

👋 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/1219215029002440785

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

frail stormBOT
#

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.

jaunty lake
#

ok so need to create 20% discount coupon first in the dashboard and then attach it to the subscription object?

$subscription = $stripe->subscriptions->create([
'customer' => $stripe_customer_id,
'items' => [[
'price' => $stripePriceId,
]],
'metadata' => $metaData,
'trial_end' => strtotime($freeTrialDays.' days'),
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
'discounts' => [[
'coupon' => '{{COUPON_ID}}',
]],
]);

#

is this correct way or need to create
$session = \Stripe\Checkout\Session::create([ object as shown in example code in above link?

dusk nacelle
#

Yes.

#

You can either create a Subscription via the API, or create a subscription Checkout Session with the discount

jaunty lake
#

ok, I'm using the subscription API already so want to continue further with it.
If I create 1 coupon with 20% discount in stripe dashabord and copy its ID and paste to project settings then Can I apply same coupon to all our 3 subscriptions plans?
So basically, whenever new user register and subscribe for the plan he should get 20% discount only first time payment and then it will be charged full amount

#

will this get achieved with single coupon applied to all subscription plans and all subscribers will get the benifit?

dusk nacelle
#

Can I apply same coupon to all our 3 subscriptions plans?
Yes, unless if you set a max redemption

#

will this get achieved with single coupon applied to all subscription plans and all subscribers will get the benifit?
Yes that's possible

#

Have you had the chance to walk through the guide I shared with you ?

jaunty lake
#

Yes, going throgh it and trying out it now

#

I need to set coupon **Duration = once **
and do **NOT ** click the checkbox box "Limit the total number of times this coupon can be redeemed" then it will be applicable to all subscription plans and user will get benifit only once. am I correct?