#carson-testing-paymentrequest

1 messages · Page 1 of 1 (latest)

keen night
#

Hi there 👋 you're right, putting test cards into Google Pay isn't an option. But, if you initialize the page with a test key, then we don't actually charge the selected card. Instead we swap the transaction to hit a test card.

#

You should see test in saying "(WON'T BE CHARGED)" near the pay button.

slate ginkgo
#

hm that's interesting, i'm initializing with a test key, but it's bringing up my currently logged in user's card

#

do i need to log out of google on chrome or something for this to work?

keen night
#

It'll still show the cards of the user you're logged in as (in my screenshot that is actually a prepaid gift card) it just won't charge that card.

slate ginkgo
#

right

#

but is it possible to test cards that throw errors?

#

or how to people test the error logic for payment request?

keen night
#

Oh, you're trying to test failures, apologies for not picking up on that sooner.

slate ginkgo
#

no worries

leaden obsidian
#

@slate ginkgo sorry for the delay, the server got quite busy. One solution here is to listen for the paymentmethod event where it creates the pm_123 for the card in Google Pay and then you can call confirmCardPayment() and pass a different PaymentMethod id such as pm_card_chargeDeclined for example to trigger a decline

slate ginkgo
#

no problem at all. i will give that a try

slate ginkgo
#

seemed to work! one last thing is, is there a method to actually close the payment request interface? something like paymentRequest.hide()?

#

for instance i want to hide the interface and show an error message to the user if they encounter an error

leaden obsidian
slate ginkgo
#

ah ok, yeah i have that, but the fail doesn't seem to actually hide the window

#

passing fail seems to show a generic error in the google payment interface but doesn't actually hide it

leaden obsidian
#

@slate ginkgo you can't control this unfortunately, it's up to each "provider". Google Pay will show the error and wait for the customer to dismiss the UI while Apple Pay shows the error for a few seconds and then hides the UI

slate ginkgo
#

gotcha, makes sense

#

thanks!