#bhanu365

1 messages · Page 1 of 1 (latest)

gleaming canopyBOT
cosmic ether
#

or when I apply a coupon of 50% or other types of percentage (leave that 100%) so I just want to render an payment element

timber oak
#

Do you mean that you want to setup the payment method regardless the discount percentage?

cosmic ether
#

This is my flow

#

Currently, what I am doing, there are 2 subscriptions of 6 months and 12 months. When I click on the button a popup appears. On the backend side, I am creating a subscription with the payment behavior "default_incomplete". But in this case, the coupon of 100%, and the duration is "Once" are not working because the coupon (once) will work only on first invoice. So I don't know what can I do now.

timber oak
#

Can you share the subscription ID (sub_xxx) that you created?

cosmic ether
#

sub_1M5NtbFmM52WOkSorL5Ez6ib

timber oak
cosmic ether
#

sub_1M5OAsFmM52WOkSo4wpWvqFB

cosmic ether
# cosmic ether

The first time the subscription will create with the "default_incomplete" payment behavior after that I am storing that subscription ID temp. and when a customer applies the coupon then I am updating the coupon on that subscription by the ID that i was storing temp.

#

But then what I see that coupon are applying on their next invoice

timber oak
#

When you created a subscription, the underlying invoice is already finalized. Once the invoice is finalized, you can't modify it.

With your coupon added after the invoice is finalised, the discount will be applied to the next cycle

cosmic ether
#

yes exactly So what can I do now? what's your recommendation?

timber oak
#

What you can do is:

  1. Let customer choose the plan and enter the coupon
  2. Create subscription with coupon if there's any and expand [pending_setup_intent, latest_invoice.payment_intent]
  3. Collect payment method
  • In step 3, if the invoice is zero, you can use client secret in pending_setup_intent to collect payment using Payment Element
  • In step 3, if the invoice is non-zero, you can use client secret in latest_invoice.payment_intent to collect using Payment Element
cosmic ether
#

Ok thanks let me try it

timber oak
#

Sounds good 👍

cosmic ether
#

I followed the above steps and when I applied the coupon of 100% the invoice has been paid without collecting the payment using the payment element or without any confirmation on our side. We need to show a button for confirmation (the confirmation will be the last step). like if customers applied a coupon and then they change their mind and close the popup of the subscription, they don't want to proceed further, what will be in this case?

  1. Then why do we use the payment element if the invoice has already been paid?
  2. We need a confirmation button then the invoice will be paid.
#

sub_1M5OkPFmM52WOkSoKp2JaAgc

timber oak
#

why do we use the payment element if the invoice has already been paid?
You can collect the payment method if the invoice is already paid with zero. In the next billing cycle, it'll be charged to the saved payment method without asking customer for the payment method again

We need a confirmation button then the invoice will be paid.
If you wish to display confirmation button with 100% coupon applied, then it can be done at your own end before creating a subscription, not after creating a subscription. Stripe always creates subscription automatically if the first invoice is zero.

cosmic ether
#

ok got it

cosmic ether
#

Can I collect the payment method before creating the subscription?

timber oak
hasty wadi
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!