Testing Steps
Careful testing is the cornerstone of software development, ensuring it operates as expected. You cannot move on to a live environment and handle real payments until you have confirmed that your integration works as desired in all scenarios.
Prerequisites
Before you start testing your Hosted Session integration, you must complete:
- Basic integration using sessions and hosted fields to gather payment details.
- Any customizations you want to make to the hosted fields on your payment page.
- Integration for any subsequent operations you want to handle within your order lifecycles.
- Any customizations related to the payment methods you want to support.
- All additional features and security-related functionality you need.
Testing your integration
Cover at least the following steps in your testing:
- For the payment methods you support, test all individual operations you want to use in your integration where payer interaction is needed on the hosted payment fields to store the necessary details into the session. Test the process from creating the session to providing the hosted fields, updating the session with the field values, and finally sending the payment transaction using the session.
- Test that any customizations you have made for the hosted fields work as expected.
- For the payment methods you support, determine the payment flows or combinations of initial and subsequent transactions you want to be able to use in your integration. Test all the flows with all possible combinations of subsequent transactions.
- Test all the additional features and security-related functionality you are using.
- Confirm that your system reacts appropriately and overcomes all common error scenarios related to invalid requests and server problems.
- Determine the transaction responses that require further actions from you, and test that your integration is taking expected actions.
Testing tools
To test your integration, the Mastercard Gateway provides some helpful tools:
- Simulators: You can test your requests using various simulators, which you access from your test merchant account. To confirm that you are using your test merchant account, check that the merchant ID supplied by your payment service provider has the prefix "TEST". All requests sent with the test merchant ID are regarded test requests and handled by the simulators. They are not sent forward to actual providers, issuers, and acquirers.
- If you already have a merchant ID that has the "TEST" prefix, that is your test merchant account, your payment service provider sends you another merchant ID when you are ready to process live transactions.
- The test merchant account is a wholly separate account with a different API password or certificates from your regular account. When switching from one to the other, make sure to change both your merchant ID and any authentication credentials.
- Test cards: If you support card payments as payment methods, the gateway provides test cards to enable you to test various scenarios, including 3D Secure authentication. For more information, see Test Cards and Testing Your Integration for 3DS Authentication.
- Predictable response results: The test simulator is configured to generate predictable results based on the transaction request and the card details you supply. For more information, see Test Cards. You can trigger transaction responses that contain a specific Mastercard Gateway Response Code or Card Security Code validation result, as well as Address Verification response code, and ensure that your integration reacts appropriately to each.
- Additional logging for testing purposes: To support additional logging while testing your Hosted Session integration using a TEST merchant ID, append
?debug=true
to the URL when including the Session JavaScript library on your payment page.
For more information on specific simulator features and options, see the test instructions within specific payment methods.
<html> <head> <script type="text/javascript" src="https://anzworldline.gateway.mastercard.com/form/version/<version>/merchant/<merchant_ID>/session.js?debug=true"></script> </head> </html>