admin管理员组文章数量:1345301
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
(Stripe\Exception\InvalidRequestException(code: 0): Invalid token id: tok_xxx at /home/zastita/public_html/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38)
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!
本文标签: javascriptGoogle Pay Invalid token id error with stripe gatewayStack Overflow
版权声明:本文标题:javascript - Google Pay Invalid token id error with stripe gateway - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743788630a2539151.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论