How to test failed payment in Google Pay test environment?

Viewed 1039

I am testing Google pay for android. I got few test cards in my Google account for payment. They are working fine for any successful payments. But I am not getting any way to fail that payment. I want to check failed response whether it could be insufficient fund or anything else. I am using Stripe as payment gateway. How to achieve this?

1 Answers

Google Pay (the button and the payment sheet) won't actually process the payment1 so therefore you won't generally receive insufficient funds from Google Pay. It returns a payment credential that you could use to process the payment with Stripe where Stripe may return a response indicating that there are insufficient funds.

I mention generally because Google Pay does expose an API that will allow you to check for sufficient funds by performing an authorization with your PSP. This is the onPaymentAuthorized callback method. The primary difference between checking in this method versus after you receive a response from Google Pay is that the payment sheet is still active and you can ask the user to choose a different payment method.

1 Google Pay may perform an authorization against the card to check to see if it is active when you add it to your account.

Related