Perform a test purchase with Yape
To test your integration with Yape you will need to create a test order using one of the phone numbers and the OTP (One-Time Password) listed below, which simulate different payment scenarios without generating a real charge. This means you can only verify your integration through a request, and not by simulating a purchase.
Since a Yape payment is processed synchronously when the order is created in automatic mode, the test result is returned in the order creation response itself. To do this, follow the steps below.
The test payment result is controlled by the phone number, whether to generate the test token or to create the test order. Use the data below to simulate each scenario.
| Phone number | OTP (One-Time Password) | status | status_detail |
| 111111111 | 123456 | processed | accredited |
| 111111112 | 123456 | failed | required_call_for_authorize |
| 111111113 | 123456 | failed | insufficient_amount |
| 111111114 | 123456 | failed | processing_error |
| 111111115 | 123456 | failed | invalid_card_token |
| 111111116 | 123456 | failed | max_attempts_exceeded |
| 111111117 | 123456 | failed | bad_filled_card_data |
| 111111118 | 123456 | failed | bad_filled_card_data |
The procedures to create the token and submit the payment are the same as in the real integration, described in Yape. The only difference is using the data from the table above instead of the payer's real data.
To create the test token, send a request with your test Public KeyPublic key linked to an application, used in the frontend to initialize and test the integration. You can find it in the application's Credentials section, within the test environment. It cannot process real payments.View test credentials, one of the test phone numbers (phoneNumber), the test OTP (otp) and a unique identifier (requestId) to the /platforms/pci/yape/v1/paymentPOST endpoint.
curlcurl --location --request POST 'https://api.mercadopago.com/platforms/pci/yape/v1/payment?public_key={{YOUR_PUBLIC_KEY}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "phoneNumber": "111111111", "otp": "123456", "requestId": "aaaaaaaa-bbbb-1ccc-8ddd-eeeeeeeeeeee" }'
If successful, you will receive a response with the data of the generated token.
json{ "live_mode": true, "luhn_validation": null, "require_esc": null, "cloned": false, "cardholder": { "identification": { "number": null, "type": null, "subtype": null }, "name": "yape" }, "security_code_id": 8069792005119486812, "security_code_length": 6, "card_number_length": 9, "expiration_month": 8, "expiration_year": 2026, "card_present_id": null, "card_id": null, "client_id": 7775327892346559, "present": null, "id": "45d013f72bf42717a1625f4c508fc20f", "card_number_id": "FFTSHQTOSJTXGFVFGJKCBAIVOUISTFZBDRTQWLYJ", "creation_date": null, "due_date": null, "last_modified_date": null, "product_id": null, "trust_level": "unknown", "public_key": "YOUR_PUBLIC_KEY", "site_id": "MPE", "status": "active", "transaction_id": null, "trunc_card_number": null, "used_date": null, "bin": "111111", "version": 0, "client_header": null, "first_six_digits": "111111", "last_four_digits": "1111" }
The id returned in the response is the test token that must be sent to your server to create the test order.
With the token created from the test data, send a request to the /v1/ordersPOST endpoint, along with your test Access TokenPrivate key linked to an application, used in the backend to authenticate operations in the test environment. You can find it in the application's Credentials section, within the test environment. It cannot process real payments and must never be exposed in the frontend.View test credentials.
curlcurl --location --request POST 'https://api.mercadopago.com/v1/orders' \ -H 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \ -H 'X-Idempotency-Key: {{SOME_UNIQUE_VALUE}}' \ -H 'Content-Type: application/json' \ -d '{ "type": "online", "external_reference": "ext_ref_1234", "processing_mode": "automatic", "total_amount": "100.00", "payer": { "email": "test_payer@example.com", "entity_type": "individual", "identification": { "type": "DNI", "number": "12345678" }, "phone": { "area_code": "51", "number": "111111111" } }, "transactions": { "payments": [ { "amount": "100.00", "payment_method": { "id": "yape", "type": "debit_card", "token": "45d013f72bf42717a1625f4c508fc20f" } } ] } }'
When using the phone number 111111111, the response returns the processed status with status_detail=accredited, indicating that the test payment was approved.
json{ "id": "ORDPE01EXAMPLEPE1234NCAKKBF68N64S", "total_amount": "100.00", "total_paid_amount": "100.00", "country_code": "PER", "currency": "PEN", "status": "processed", "status_detail": "accredited", "transactions": { "payments": [ { "id": "PAYPE01EXAMPLEPE1234BSAR5ZWXX5YZG", "amount": "100.00", "paid_amount": "100.00", "status": "processed", "status_detail": "accredited", "payment_method": { "id": "yape", "type": "debit_card" } } ] } }
For the other phone numbers in the table, the response returns status=failed with the status_detail corresponding to the simulated scenario.
Finally, to verify that the test purchase was carried out correctly, send a request to the /v1/orders/{id}GET endpoint, replacing id with the order identification received in the response to its creation.
Alternatively, you can check the payment result from your application. To do so, go to Integrations and select the application card. Make sure the selector at the top is set to Test and, on the Home screen, select the Test payments tab. Then, find the payment and click it to view its details and status.
Ready! Once these steps are completed, the integration of Yape as a payment method is complete, and you can either continue testing other integrated payment methods, or go to production.