I'm using stripe to process payments in my app.
I have created a plan and I have some coupons.
I am creating a subscription using following code.
customer.subscriptions.create(plan=PLAN_type,coupon=PROMO_CODE)
but I want to know the amount the customer going to charged if he appy coupon, so that I can display it to him on a webpage.
I am able get the amount of a plan and discount offered by a coupon. But now I want the total amount after applying the coupon.
I can do this by manually applying discount to the amount , but I want to know is there a way from API to do this
From Stripe Support: "I'd say that you cannot add a 100% off discount in Stripe Checkout. It doesn't allow purchase below the minimum charge amount for one-time payments.
In the Dashboard on the Create a coupon page, click the Use customer-facing coupon codes button. Enter a code. This is the code that a customer enters at checkout to redeem the discount. If you don't set a code, Stripe generates one for you.
Accessing Promotion Codes Some new features, such as Promotion Codes on Stripe Billing or Checkout, is only available to paid Billing users.
Click the Products Tab from the Stripe dashboard. Then, select Coupons. Click + New in the top right corner of the Coupons page. On this page, give your new coupon a Title, select the coupon type between a Percentage discount or a Fixed Amount discount, choose the amount of the discount, and the time Duration.
I don't think there would be a way to know the amount your customer is going to be charged upfront. If you want to display this to your customer before creating the subscription you have to calculate this on your end.
If you just want to confirm the total charged after the subscription has been created, you would retrieve the invoices for that customer with the List Customer Invoices API.
The invoice you're looking for should be the first one since it was the latest created, but to be safe you should check the corresponding subscription
to make sure it corresponds to the subscription you just created. You would then be able to retrieve the total
from that invoice to know how much you charged your customer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With