# MD for: https://www.mercadopago.com.pe/developers/en/docs/checkout-api-orders/integration-test/yape.md \# 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. :::AccordionComponent{title="Use the test data"} 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\](https://www.mercadopago.com.pe/developers/en/docs/checkout-api-orders/payment-integration/websites/yape). The only difference is using the data from the table above instead of the payer's real data. ::: :::AccordionComponent{title="Create test Yape token"} To create the test token, send a request with your :toolTipComponent\[test Public Key\]{link="/developers/en/docs/your-integrations/credentials" linkText="View test credentials" content="Public 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."}, one of the test phone numbers (\`phoneNumber\`), the test OTP (\`otp\`) and a unique identifier (\`requestId\`) to the :TagComponent{tag="POST" text="/platforms/pci/yape/v1/payment" href="https://api.mercadopago.com/platforms/pci/yape/v1/payment?public\_key={{YOUR\_PUBLIC\_KEY}}" color="green"} endpoint. \`\`\`curl curl --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. > WARNING > > Generate a new token for each test payment attempt, as it expires after the first use. ::: :::AccordionComponent{title="Create test order"} With the token created from the test data, send a request to the :TagComponent{tag="POST" text="/v1/orders" href="/developers/en/reference/online-payments/checkout-api/create-order/post" color="green"} endpoint, along with your :toolTipComponent\[test Access Token\]{link="/developers/en/docs/your-integrations/credentials" linkText="View test credentials" content="Private 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\_."}. \`\`\`curl curl --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. ::: :::AccordionComponent{title="Verify the purchase status"} Finally, to verify that the test purchase was carried out correctly, send a request to the :TagComponent{tag="GET" text="/v1/orders/{id}" href="/developers/en/reference/online-payments/checkout-api/get-order/get" color="accent"} 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\](https://www.mercadopago.com.pe/developers/panel/app)\*\* 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\](https://www.mercadopago.com.pe/developers/en/docs/checkout-api-orders/go-to-production).