Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11691

Get a client secret when the amount is zero

$
0
0

I use the Payment Element to allow people to sign up for my service. I create an intent like this:

const subscription = await stripe.subscriptions.create({    customer: customer.id,    items: [{ price }],    // Tell stripe we don't have the card details yet.    payment_behavior: "default_incomplete",    payment_settings: { save_default_payment_method: "on_subscription" },    expand: ["latest_invoice.payment_intent"],    coupon: coupon || undefined,  });

This works great and I get a client secret to then render the payments element, however if I offer a discount code, which make the initial payment 0, this call does not give me a client secret, since there is "no invoice to pay". Is there any way to get a client secret and offer coupon codes that make the first payment 0?


Viewing all articles
Browse latest Browse all 11691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>