#rups
1 messages · Page 1 of 1 (latest)
hello
Hi,
Could you please share more details ?
yes
I need to create subscription with couponcode and have 25% discound.
hope requirement is clear to you
there?
hello
I'm monitoring your thread.
ok
Check this guide:
https://stripe.com/docs/billing/subscriptions/coupons
im not using checkout session.
on server level > php
creating subscription default incomplete. e.g.:
|$subscribe = \Stripe\Subscription::create([
"customer" => $user['stripeCustomerId'],
"items" => [
[
"plan" => $stripePlanId,
],
],
'coupon' => $couponCode,
'payment_behavior' => 'default_incomplete',
'expand' => ['latest_invoice.payment_intent'],
]);
$response = [
'stripePlanId' => $stripePlanId,
'subscriptionId' => $subscribe->id,
'clientSecret' => $subscribe->latest_invoice->payment_intent->client_secret,
'status' => $subscribe->status
];
The guide I'm sharing is how to apply a coupon for a Subscription using API (you can check php code)
https://stripe.com/docs/billing/subscriptions/coupons?dashboard-or-api=api
yes as per your link subscription is created.
but 3d secure is asking for full amount and my invoice is also generated with full amount.
after subscription created in incomplete with coupon code
stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: cardElement,
billing_details: {
name: customer_name,
},
},
return_url: "<?php echo base_url('paymentreturn.html'); ?>"
})
on fron side im calling above method
Could you please share a Subscription Id ?
actually currently it is working well
Ah cool.