google-pay / google-pay-button

Google Pay button - React, Angular, and custom element
Apache License 2.0
247 stars 60 forks source link

Get token empty in tokenizationData data from onLoadPaymentData method #257

Closed kukadiyaAni closed 8 months ago

kukadiyaAni commented 9 months ago

I set the Google Pay button with Braintree but I'm getting a token that is empty in onLoadPaymentData method

This question is related to:

        environment="TEST"
        buttonType="buy"
        paymentRequest={{
          apiVersion: 2,
          apiVersionMinor: 0,
          merchantInfo: {
            merchantId: "google merchant id",
            merchantName: "Prank Caller",
          },
          allowedPaymentMethods: [
            {
              type: "CARD",
              parameters: {
                allowedAuthMethods: ["PAN_ONLY", "CRYPTOGRAM_3DS"],
                allowedCardNetworks: ["MASTERCARD", "VISA"],
              },
              tokenizationSpecification: {
                type: "PAYMENT_GATEWAY",
                parameters: {
                  gateway: "braintree",
                  "braintree:clientKey": "clien token",
                  "braintree:apiVersion": "3",
                  "braintree:sdkVersion": "3.97.2",
                  "braintree:merchantId": "test id", // test
                },
              },
            },
          ],
          transactionInfo: {
            totalPriceStatus: "FINAL",
            totalPriceLabel: "Total",
            totalPrice: "1.00",
            currencyCode: "USD",
            countryCode: "US",
          },
        }}
        onLoadPaymentData={(paymentRequest) => {
          console.log("load payment data", paymentRequest);
        }}
      />

Thanks in advance any can help me on this

dmengelt commented 9 months ago

@kukadiyaAni make sure to use the correct braintree parameters. As an example, did you use the correct braintree:merchantId?

Also, if you could create a re-producer for me that would help a lot.

kukadiyaAni commented 9 months ago

@dmengelt Thanks for reply, braintree:merchantId is correct and verified if directly did using Braintree method it's worked

dmengelt commented 9 months ago

thanks @kukadiyaAni

Could you try with the following braintree parameters:

'braintree:apiVersion': 'v1',
'braintree:sdkVersion': 'braintree.client.3.40.0',
'braintree:merchantId': 'your-merchant-id',
'braintree:clientKey': 'sandbox_1234'

For the braintree:clientKey try to use a tokenization key generated in Braintree's portal

Screenshot 2023-10-19 at 16 37 47
kukadiyaAni commented 9 months ago

@dmengelt I still get the same issue token is empty but I fixed by preventing native click of the button and using Braintree code to generate process payment

dmengelt commented 9 months ago

@kukadiyaAni what do you mean with "preventing native click"? Could you share a code example?

dmengelt commented 8 months ago

No feedback for a while. Feel free to re-open if the problem still occurs.