Apple Pay Token Not Valid Base64

I use Apple Pay Sandbox Account with Sandbox Credit Card to generate token with Apple Pay JS.

 session.onpaymentauthorized = function (event) {
        var token = JSON.stringify(event.payment.token);

But when I try to send this token to the provider,

"paymentData":
 {
  "version":"EC_v1",
  "data":"VYZcdBkTfPmHnVd/....",
  "signature":"MIAGCSqGSIb3DQEHA...",
  "header":
   {
      "ephemeralPublicKey":"MFkwEwYHKoZ...",
      "publicKeyHash":"yb+QUlF2y...",
      "transactionId":"7db6...."
   }
 }

https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickPaymentMethod/devicePayments/ApplePay.html?locale=en_US

token.paymentData.data not passed the base64 validation.

Do I need to make any changes before sending this token to provider?

Accepted Answer

Do I need to make any changes before sending this token to provider?

Typically no, you will just need to send this to your payment provider and if your provider is using the correct Payment Processing Identity that corresponds with the public key that encrypted your payment token then you should be able to verify the signature.

Regarding:

token.paymentData.data not passed the base64 validation.

Which part is failing here in the verify signature process described below?

https://developer.apple.com/library/archive/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Apple Pay Token Not Valid Base64
 
 
Q