You can do either and you don't / shouldn't mix the two approach
Based on the Stripe doc here You can either use
- Stripe's PaymentRequestButton
- OR you can integrate with Google Pay directly using Stripe as a gateway. See how to do it here; in Step 2 of the tutorial, search
stripe to find the gateway configurations
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
"gateway": "stripe"
"stripe:version": "2018-10-31" // your stripe API version
"stripe:publishableKey": "pk_test_xxxx" // your stripe publishable key
}
};
For option 2, you will basically get a Stripe token like this tok_xxxx represent the GooglePay wallet from paymentData.paymentMethodData.tokenizationData.token, and you can use the token directly with Stripe API using your Stripe's secret key sk_test_xxxx e.g. create a charge following this
const stripe = require('stripe')('sk_test_xxxxx');
const charge = await stripe.charges.create({
amount: 2000,
currency: 'usd',
source: 'tok_obtained_from_google_pay_api',
description: 'My First Test Charge (created for API docs)',
});
FYI token/charge API is no longer recommended, you can create a payment_method from the token like this
const paymentMethod = await stripe.paymentMethods.create({
type: 'card',
card: {
token: 'tok_xxxxx',
},
});
and use it with Stripe PaymentIntent API