I’m working on a web application where a seller needs to authorize buyer’s credit card and then charge it when the item is shipped, I’m using Stripe’s PaymentIntent.create
with manual capture, first I create a PaymentMethod and then use it to create the PaymentIntent:
async function createPaymentIntent(paymentMethodId) {
try {
const paymentIntent = await stripe.paymentIntents.create({
amount: price, // Amount in cents
currency: 'usd',
payment_method: paymentMethodId,
capture_method: 'manual',
});
console.log('Payment Intent:', paymentIntent);
return paymentIntent.client_secret;
} catch (error) {
console.error('Error creating PaymentIntent:', error);
throw error;
}
}
Now, I need to add Apple Pay support. Stripe’s documentation mentions that authorization and capture with Apple Pay is possible (link), but I couldn’t find any detailed instructions on how to actually implement it.
How should I approach adding Apple Pay to this setup to ensure proper authorization and capture flow? Any guidance or advise is greatly appreciated!