The Setup Intents API lets you save a customer’s card without an initial payment. This is helpful if you want to onboard customers now, set them up for payments, and charge them in the future—when they’re offline. Read more here.
const {clientSecret} = await fetch('/create-setup-intent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
}).then((r) => r.json());
addMessage('Setting up the card for future payments ...');
stripe.confirmCardSetup(clientSecret, {
payment_method: {
card: cardElement,
billing_details: {
name: 'Jenny Rosen',
},
},
}).then((result) => {
if (result.error) {
addMessage(result.error.message);
} else {
addMessage('Card setup for future payments! 🎉');
};
});
Make copies, remix, change and learn how to play with this tinydemo.
Reach out to us on any of our contact channels: