I’m integrating Google Pay with Stripe in my webshop. The integration works perfectly in test mode, but when I switch to production, I get Invalid token id from stripe
My javascript code: ( I successfully retrieve the Google Pay token and send it to my backend )
let paymentToken = JSON.parse(paymentData.paymentMethodData.tokenizationData.token);
let transactionInfo = await getGoogleTransactionInfo();
let response = await fetch('/stripe/processGooglePayPayment', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
token: paymentToken.id,
totalPrice: transactionInfo.totalPrice,
currencyCode: transactionInfo.currencyCode,
})
});
My backend code:
Stripe::setApiKey(config('shop.stripe_keys.stripe_secret_key'));
$googlePayToken = $request->input('token');
$totalPrice = $request->input('totalPrice');
$currencyCode = $request->input('currencyCode');
$paymentMethod = PaymentMethod::create([
'type' => 'card',
'card' => [
'token' => "$googlePayToken", // Invalid token id
],
]);
I ensure that both of Stripe and Google Pay is in production, Google Pay environment variable is set to PRODUCTION
, I pass the merchantID too, and I use the live secret key
to initialize Stripe.
I searched for the solution in Stripe and Google Pay documentations, but I can’t find anything related to this, anyone who is faced with this error too?
Any help would be appreciate!