Skip to main content

Testing

Testing the Google Pay integration

Test in the sandbox environment first.

Test device setup

Google Pay sandbox uses real Google accounts but routes all transactions through Google's test infrastructure. You need:

  • A modern browser that supports Google Pay. WebView does not work, see Prerequisites.
  • A Google account signed in on that device.
  • At least one test card added to Google Wallet. Use Google's test card suite: the cards listed there are the only ones that will work against the sandbox.
note

You do not need a Google Pay & Wallet Console account to test. Google sandbox runs against the test card suite on any logged-in Google account.

Pre-flight checklist

CheckWhere to verify
Page is served over HTTPSBrowser address bar
Component bundle loads from test-pay.dnapayments.comNetwork tab
Google Pay is enabled on your terminal in test-portal at Settings → Online payment methods → Google PayPortal UI
At least one Google test card is added to Google WalletWallet app
The page is not loaded inside a WebViewOpen the page directly in Chrome / Safari, not inside an embedded view

Scenarios to run

ScenarioHow to triggerExpected event
Successful paymentRun the full flow with a Google test cardonPaymentSuccess(result)
3-D Secure challengeUse a test card that requires 3DSA built-in 3DS modal renders; onPaymentSuccess fires after the customer completes the challenge
User cancels the sheetOpen the Google Pay sheet, dismiss itonCancel()
paymentData missingCall init() without paymentDataonError({ code: 1006 })
Token missingCall init() without token and do not return one from onBeforeProcessPaymentonError({ code: 1007 })
paymentData mismatchReturn paymentData from onBeforeProcessPayment whose amount, currency or delivery address differs from the values passed at init()onError({ code: 1010 })
onBeforeProcessPayment throwsThrow an exception inside onBeforeProcessPaymentonError({ code: 1005 })

See Handling Error Codes for the full code list.

Troubleshooting

  • Button does not render. Most often onError({ code: 1003 }): the device cannot run Google Pay. Check that the page is not loaded inside a WebView, that the browser supports Google Pay, and that a card is present in Google Wallet.
  • Sheet opens but the wallet has no cards. Add a card from Google's test card suite. Live cards will not appear in the sandbox wallet flow.
  • 1010 after the customer authorizes. Your onBeforeProcessPayment is returning a paymentData with a different amount, currency or delivery address than the one passed at init(). Use onBeforeProcessPayment to add server-side fields (like invoiceId), not to change the displayed total. If the cart amount can change, re-initialize the component.