8
votes

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

1

1 Answers

3
votes

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.