google-pay-button icon indicating copy to clipboard operation
google-pay-button copied to clipboard

JWT solution for react google pay button

Open devalensio opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe.

Yes, the problem is that the current Google Pay Button implementation in React does not allow the use of the JWT solution provided by the Google Pay API for Web. This solution is crucial for platform partners who manage more than 100 web domains, as it allows the integration of Google Pay without registering individual web domains in the Google Pay & Wallet Console. Specifically, there is no support for passing the authJwt and merchantOrigin parameters in the merchantInfo object, which are necessary for using JWT.

Describe the solution you'd like

Please add support for authJwt and merchantOrigin in the merchantInfo object in the Google Pay Button for React. This would allow developers to use the JWT solution directly in their payment requests.

<GooglePayButton
  environment="TEST"
  paymentRequest={{
    apiVersion: 2,
    apiVersionMinor: 0,
    allowedPaymentMethods: [
      {
        type: 'CARD',
        parameters: {
          allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
          allowedCardNetworks: ['MASTERCARD', 'VISA'],
        },
        tokenizationSpecification: {
          type: 'PAYMENT_GATEWAY',
          parameters: {
            gateway: 'example',
            gatewayMerchantId: 'exampleGatewayMerchantId',
          },
        },
      },
    ],
    merchantInfo: {
      merchantId: '12345678901234567890',
      merchantName: 'Demo Merchant',
      // Add support for these fields:
      // authJwt: 'aaaaa.bbbbb.ccccc',
      // merchantOrigin: 'sub-merchant.com',
    },
    transactionInfo: {
      totalPriceStatus: 'FINAL',
      totalPriceLabel: 'Total',
      totalPrice: '100.00',
      currencyCode: 'USD',
      countryCode: 'US',
    },
  }}
  onLoadPaymentData={paymentRequest => {
    console.log('load payment data', paymentRequest);
  }}
/>

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Adding support for authJwt and merchantOrigin will significantly ease the integration process for platform partners using the JWT solution. This feature is particularly beneficial for developers who manage multiple sub-merchants under one platform, simplifying the onboarding process and reducing the need to register each domain separately.

devalensio avatar Sep 06 '24 16:09 devalensio

@devalensio thanks for reporting this. you have a very good point 😉 we will look into it...

dmengelt avatar Sep 09 '24 08:09 dmengelt

Thanks for the response @dmengelt really looking forward to the feature, as of now, I'm considering using the Google Pay script and passing the data manually. However, I would prefer to use a React button library for our Google Pay integration.

devalensio avatar Sep 10 '24 09:09 devalensio

Yes. For now you would need to integrate using pay.js directly.

dmengelt avatar Sep 10 '24 09:09 dmengelt

can I contribute to the project for this feature @dmengelt ?

devalensio avatar Sep 11 '24 09:09 devalensio

@devalensio yes of course! A couple of thoughts:

  • Make sure to first update the Google Pay types to support authJwt and merchantOrigin
  • Please update all the different implementation is this repo (not only the React one)

dmengelt avatar Sep 11 '24 12:09 dmengelt