If your integration uses Card Element or individual payment method Elements, we recommend migrating to the Payment Element. This single, unified integration allows you to accept over 25 different payment methods.
Create the PaymentIntent
In this version of the API, specifying the automatic_payment_methods.enabled parameter is optional. If you don’t specify it, Stripe assumes a value of true
, which enables its functionality by default.
curl https://api.stripe.com/v1/payment_intents \
-u "sk_test_4eC39HqLyjWDarjtT1zdp7dc
:" \
-d amount=1099 \
-d currency=usd
Client-side confirmations with Stripe.js
If your integration uses Stripe.js to confirm payments with confirmPayment or by payment method, your existing processes remains the same and requires no further changes.
When you confirm payments, we recommend that you provide the return_url parameter. This allows you to accept payment methods that require redirect.
const form = document.getElementById('payment-form');
form.addEventListener('submit', async (event) => {
event.preventDefault();
const {error} = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: 'https://example.com/return_url',
},
});
if (error) {
const messageContainer = document.querySelector('#error-message');
messageContainer.textContent = error.message;
} else {
}
});
Server-side confirmation
If you use server-side confirmation, you must use the return_url parameter in your integration.
curl https://api.stripe.com/v1/payment_intents \
-u "sk_test_4eC39HqLyjWDarjtT1zdp7dc
:" \
-d amount=1099 \
-d currency=usd \
-d confirm=true \
-d payment_method= \
--data-urlencode return_url="https://example.com/return_url"
Alternatively, you can create the PaymentIntent or SetupIntent with the automatic_payment_methods.allow_redirects parameter set to never
. This disables the return_url
requirement on confirmation. You can still manage payment methods from the Dashboard, but the payment methods that require redirects won’t be eligible.
curl https://api.stripe.com/v1/payment_intents \
-u "sk_test_4eC39HqLyjWDarjtT1zdp7dc
:" \
-d amount=1099 \
-d currency=usd \
-d confirm=true \
-d payment_method= \
-d "automatic_payment_methods[enabled]"=true \
-d "automatic_payment_methods[allow_redirects]"=never
Lastly, you can create the PaymentIntent or SetupIntent with the payment_method_types parameter. This also disables the return_url
requirement on confirmation. With this option, you can’t manage payment methods from the Dashboard.
curl https://api.stripe.com/v1/payment_intents \
-u "sk_test_4eC39HqLyjWDarjtT1zdp7dc
:" \
-d amount=1099 \
-d currency=usd \
-d confirm=true \
-d payment_method= \
-d "payment_method_types[]"=card