BACKGROUND
Hi, I’ve been stuck with this the past few days, and the email to square didn’t answer me, so hopefully someone here can help out??? Anyways, I have the Web Payments SDK setup properly. It works fine for credit / debit / gift cards, and partially google pay. I am not using node, but that shouldn’t matter because the only relevant part here is the front end JavaScript.
GOAL
Enable google pay so people can click a button, and have a real life product shipped to them automatically. Just 1 click, and done.
PROBLEM
Everything works so far. I got google pay to make the sale correctly. BUT, I’m only getting part of the shipping contact details back. Specifically, I’m only getting the city, countryCode, postalCode, and state… But I need their name, street address, and email at a minimum for the shipping, otherwise I have to get them to fill out extra details they probably don’t want to.
RELEVANT PARTS OF MY CODE
First, I already setup google pay. See the images below for proof. I would host them here, but I’m getting 422 errors from your site for it. I’m blocking out the details, but all of the data on it is correct. They have my real info.
Google pay privacy settings are shared.
So, I make the paymentRequest object…
const req = payments.paymentRequest({
// ...
requestShippingContact: true,
});
The PaymentRequest API page says that when I have requestShippingContact: true, then it should be giving me ALL the ShippingContact data.
Then I add the shippingcontactchanged method the docs say to add:
req.addEventListener('shippingcontactchanged', (contact) => {
console.dir(contact);
}
When I click the google pay button, ALL the REAL data I gave google pay is showed to me, but only in the popup. It shows my real full name, address, phone number, etc. notice how it even says: “Your billing details will also be shared with the merchant”.
But when the above console.dir(contact) runs, the only value I’m returned is the city, countryCode, postalCode, and state:
console.dir(contact) shows this.
Every value all of these things return is correct. It’s what I gave to google pay. I didn’t fill out any details on my site. So it’s only what google is giving me.
And that code runs in the console every time I try to change the address due to the event listener, so I know it’s running.
As a test, I also checked the console, and network requests from the popup… But nothing there either. That wouldn’t make sense anyway, but I did it just to see.
QUESTION
Why isn’t it giving me the rest of the details from the ShippingContact object??? Specifically: addressLines, email, familyName, and givenName???
Did square or google disable this or something?? Is there some hidden setting I didn’t enable in google wallet or square?? Because I’d really like this one click functionality to work correctly.
Any help is greatly appreciated.