Perform a test purchase
Next, we will teach you how to simulate a complete payment flow for dynamic QR code model.
Create an order
- Log in to the Mercado Pago website using the username and password of the test seller account you created.
- Create a new test application for QR Code and obtain the production credentials (Access Token) of the test seller user.
- Use the production credentials of the test seller user to create a store and a point of sale following the instructions for setup. Please note that when creating the point of sale, the
fixed_amount
field should be set ontrue
. - Still using the credentials of the test seller user, create an order and assign it to the point of sale you created in the previous step. Make sure to set the
notification_url
field with the URL where you will receive notifications about payment updates with themerchant_order
topic. - Use the
qr_data
parameter obtained in the response to the order creation to generate a QR code. You can use tools or libraries that will help you convert this data into a QR code image.
Perform the payment
- Download and install the Mercado Pago App on your mobile device and log in with the test buyer account.
- Scan with your mobile device the QR code you generated. The app will display the amount of the generated order and the available payment options.
- Make the payment using test cards, which will also allow you to test different payment flows.
Validation cases
If you want to, you can test various scenarios to validate that your system is correctly integrated with Mercado Pago. These are situations that simulate possible scenarios when making a payment.
Below, you can see these cases in detail, along with the expected result in the system for each scenario, and a series of observations to guide you on how to proceed.
Case | Expected output | Observations |
Correct QR scanning. The user scans a valid QR Code, that is, a QR with a previously assigned order. | App showcases a checkout screen with the assigned amount. | Verify that the amount displayed on the screen is the one assigned when creating the order. If itâs not, validate if the order war assigned to the correct point of sale. |
Approved payment. The user makes a successful payment. | Point of sale system receives information about the approved payment. | Verify if you have received the notification with the merchant_order topic, and that its status is closed . |
Rejected payment. The user makes a payment that ends up being rejected. | The point of sale system receives information about the rejected payment and continues waiting for the order to be paid. | Verify if you have received the notification with the merchant_order topic, and that its status is opened . You must wait for the second payment attempt. |
Second payment attempt. At first, the user performs a rejected payment and, without needing to scan the Code again, they execute a second attempt, that ends up being approved. | The point of sale system receives information about the rejected payment and of the approved one later. | Verify that your Point of Sale system doesnât close the transaction. |
Order expiration. The user attempts to pay after the QR has expired. | The order expires and, when scanning the QR Code, an error screen is displayed. | Verify if you have established the expiration_date field when creating the order, and that it is prior to the moment when itâs scanned. |
Verify notifications
After you have made the payment with the test user, verify that you have received notifications with the merchant_order
topic indicating the status of the order in your system.
To ensure that notifications have been processed correctly, send a GET request to the /merchant_orders endpoint with the ID of the merchant order received in the notification. This will allow you to validate the status of each order:
- If the returned status is
closed
, the order was successfully paid. - If the returned status is
opened
, the order has not been paid yet. You should wait for the payment to be made and approved.