Simulate shopper action
You can conduct end-to-end testing of your local payment methods integration by simulating shopper actions after being redirected to the payment page in the demo environment. To learn about local payment methods offered by Airwallex Online Payments, see payment methods.
Key simulation scenarios include:
- Simulate a successful or failed payment on a payment intent.
- Simulate verification of a payment method on a payment consent.
The redirect URL is obtained from the response of a PaymentIntent or PaymentConsent. A successful simulation of a shopper action on the given URL will return HTTP status 200 OK and an empty body.
As a platform account, you can call the simulation APIs on behalf of a connected account using the x-on-behalf-of
header.
Pay or reject a payment
Call Simulate shopper action API with the following action
URL parameter and request body field.
action
: In the URL path, specifypay
orreject
to simulate a successful or failed payment respectively.url
: Specify thenext_action.url
obtained from the response of Confirm a PaymentIntent API in the demo environment. The shopper action will be simulated after redirection to this URL.
Create a simulation for successful payment
Create a simulation for failed payment
Verify a payment consent
Call Simulate shopper action API with the following fields.
action
: In the URL path, specifyverify
to simulate PaymentConsent verification with the payment method details.url
: In the request body, specify thenext_action.url
obtained from the response of Verify a PaymentConsent API in the demo environment. The verification will be simulated after redirection to this URL.
Create a simulation for consent verification
Troubleshooting
You might encounter the following errors when simulating payment APIs.
Error scenario | Error code | Error response | Recommended actions |
---|---|---|---|
Invalid action in action parameter |
validation_error | {
|
Check input and pass valid values for action parameter. |
Invalid URL in url parameter |
validation_error | {
|
Check input and pass valid values for url parameter. |
Unsupported action for the url parameterFor example, a PaymentConsent URL passed as a URL for a payment that only supports `pay` and `reject`. Or, if the URL is not generated with the payment_intent/confirm API, hence not recognized by our system. |
operation_not_supported | {
|
Check the url and action values and make sure the url can support the action. | General failures in the system. | internal_error | {
|
Contact Airwallex support. |