I want to implement the stripe payment gateway into my project where I will get the Apple Pay token from the client side. but how could I pass it because when I am trying to pass it stripe will through an error StripeInvalidRequestError: Invalid string: eyJkYXRhIj...FfdjEifQ==; must be at most 5000 characters
const paymentIntent = await stripe.paymentIntents.create({
amount: 1*100,
currency: 'usd',
payment_method_types: ['card'],
payment_method_data: {
type: 'card',
card: {
token: req.body.AppleToken // Payment token received from iOS app
}
}
});
// Process the payment request with Stripe
const paymentResult = await stripe.paymentIntents.confirm(paymentIntent.id);
// If payment is successful
if (paymentResult.status === 'succeeded') {
res.status(200).json({ success: true, message: 'Payment successful' });
} else {
res.status(500).json({ success: false, error: 'Payment failed' });
}
I am getting error StripeInvalidRequestError: Invalid string: eyJkYXRhIj...FfdjEifQ==; must be at most 5000 characters Does anything have any idea about how to pass the apple token into the stripe?
Using raw Apple Pay tokens with Stripe is discouraged. You can use the Express Checkout Element, Payment Element, or Mobile Payment Element, that all support Apple Pay out-of-the-box.
If you really need to use raw Apple Pay tokens for some reason, you could try talking to Stripe Support.