Retrieving Paypal Google Pay email address using React

32 views Asked by At

I am trying to retrieve my email address using the JS SDK from Paypal for their Google pay integration.

I set up my PaymentDataRequest to require the email as below, but I don't see my email address in the response object.

PaymentDataRequest:

async function getGooglePaymentDataRequest() {
    const { allowedPaymentMethods, merchantInfo, apiVersion, apiVersionMinor, countryCode, emailRequired} = await getGooglePayConfig();
    const baseRequest = {
      apiVersion,
      apiVersionMinor
    };
    const paymentDataRequest = Object.assign({}, baseRequest);
    
    paymentDataRequest.allowedPaymentMethods = allowedPaymentMethods;
    paymentDataRequest.transactionInfo = getGoogleTransactionInfo(countryCode);
    paymentDataRequest.merchantInfo = merchantInfo;
    paymentDataRequest.emailRequired = true;
    paymentDataRequest.callbackIntents = ["PAYMENT_AUTHORIZATION"];

    return paymentDataRequest;

Response after my payment gets processed:

const confirmOrderResponse = await paypal.Googlepay().confirmOrder({
    orderId: orderData.id,
    paymentMethodData: paymentData.paymentMethodData
  });
1

There are 1 answers

0
Rutnet On