cancel
Showing results for 
Search instead for 
Did you mean: 

Google Pay for the web integration with Authorize.net problem

Hello guys,

 

Recently (well not really recently) Android Pay has been replaced with Google Pay,

and its documentation AND javascript API has changed (and previous doumentation is not available anywhere). 

 

I am trying to implement Google Pay "for the web" integration, meaning I will not use any Android SDKs, but a simple Google Pay integration for my ecommerce online store.

 

I followed up everything written on this page: 

https://developer.authorize.net/api/reference/features/in-app.html#Google_Pay

 

and it all works fine until the last step: 

let token = paymentData.paymentMethodToken.token;
var enc = window.btoa(token);
			

Currently, there is no paymentMethodToken at all in Google Pay. I guess the reference is to API v1 and recent API is v2. So instead, they changed it to be

 

paymentToken = paymentData.paymentMethodData.tokenizationData.token;

which also seem to work, and even returns some kind of a valid token (a json object with lots of data and keys).

 

 

Finally, when I try to 

var enc = window.btoa(paymentToken);

 and send it to Authorize.net createTransactionRequest, it fails with the error: 

 

Payment failed: [153] There was an error processing the payment data. Unable to decrypt data.

 

Apparently, it seems that the token itself has changed (or maybe I am wrong), but the Authorize is not capable to decrypt this kind of token from the V2 API of Google Pay.

 

Lastly, there is no example from Authorize on how to properly use the token for the web (example is only available for Android), while it is available for Apple Pay for the web which works great.

 

Any help would be much appreciated! 

Has anyone tried to integrate Google Pay for the web with Authorize?

Has anyone succeeded in accepting payments via Google Pay using Authorize on a simple website?

 

Thanks!

abbatweb
Member
12 REPLIES 12

I made a successful transaction.

You need the specification to look like this:

var tokenizationSpecification = {
  type: 'PAYMENT_GATEWAY',
  parameters: {
    'gateway': 'authorizenet',
    'gatewayMerchantId': '[GatewayID from AuthNET]'
  }
};

The gateway ID can be obtained from here:
https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-merchant-details

And from the transaction, you need to get the paymentToken and base64 encode it:

var paymentToken = paymentData.paymentMethodData.tokenizationData.token;
var encodedToken = btoa(paymentToken);

and send the encodedToken to the API.

I hope this helps!

kr1skyyy
Member

Thanks for the reply @kr1skyyy  - I'm wading through the docs and SDKs looking for clues on where to actually PUT the token when it is received back from Apple or Google.  Been testing with the PHP versions of the SOAP and REST kits, and have had back and forth with support to no avail.

So:

When assembling the package - either using the SOAP or REST kits - where does the encodedToken go?
Have taken a walk through the published WSDL and have looked through each example/sample...almost all of which have the 'plain text' PAN and no reference to the token, fluid, or other field.

 

cheers...mr_al 

mr_al
Member

Hi @mr_al,

I used the live API console to test the token that I got from the front end:

https://developer.authorize.net/api/reference/index.html#mobile-in-app-transactions-create-a-google-...

In order to use the API Console, you have to log in first. Scroll to the top of the page above and find this section:
https://imgur.com/a/JGnQQJu.

 

Then edit the example request and fill the dataValue field with the encodedToken.

Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.