# MD for: https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/integration-test.md \# Test integration Before going to production, it is essential to test the complete Automatic Payments flow via Orders. This will allow you to verify that the creation of customers, payment profiles, and transactions is done correctly before receiving real payments. Throughout the process, you must use your :toolTipComponent\[test credentials\]{content="Access keys that identify your test user, used in development stages or to test the integration. You can access them through \*Your integrations > Application details > Tests > Test credentials\*."} to ensure that the tests work correctly. > WARNING > > Any entity created with test credentials in Automatic Payments, whether payments or profiles, will be deleted after three months from its creation. Follow the steps below to test your integration. :::AccordionComponent{title="Tokenize a test card" pill="1"} First, you must \[tokenize the payment method\](https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/tokenize-payment-method). Mercado Pago provides \*\*test cards\*\* that will allow you to test payments without using a real card. Their data, such as number, security code, and expiration date, can be combined with the \*\*data relating to the cardholder\*\*, which will allow you to test different payment scenarios. That is, \*\*you can use the information of any test card and test different payment results based on the cardholder's data\*\*. Below, you can see the data of the \*\*test debit and credit cards\*\*. Select the one you want to use to test your integration. | Card type | Flag | Number | Security code | Expiration date | | :--- | :---: | :---: | :---: | :---: | | Credit card | Mastercard | 5031 7557 3453 0604 | 123 | 11/30 | | Credit card | Visa | 4509 9535 6623 3704 | 123 | 11/30 | | Credit card | American Express | 3711 803032 57522 | 1234 | 11/30 | | Debit card | Mastercard | 5287 3383 1025 3304 | 123 | 11/30 | | Debit card | Visa | 4002 7686 9439 5619 | 123 | 11/30 | Next, choose which payment scenario to test and fill in the \*\*cardholder's information\*\* (First name and last name, Document type and number) as indicated in the table below. | Payment Status | Cardholder’s first and last name | Identity document | | --- | --- | --- | | Approved payment | \`APRO\` | (DNI) 12345678| | Declined for general error | \`OTHE\` | (DNI) 12345678 | | Pending payment | \`CONT\` | - | | Declined with validation to authorize | \`CALL\` | - | | Declined for insufficient amount | \`FUND\` | - | | Declined for invalid security code | \`SECU\` | - | | Declined due to due date issue | \`EXPI\` | - | | Declined due to form error | \`FORM\` | - | | Rejected for missing card\_number | \`CARD\` | - | | Rejected for invalid installments | \`INST\` | - | | Rejected for duplicate payment | \`DUPL\` | - | | Rejected for disabled card | \`LOCK\` | - | | Rejected for non-permitted card type | \`CTNA\` | - | | Rejected due to exceeded PIN attempts | \`ATTE\` | - | | Rejected for being on the blacklist | \`BLAC\` | - | | Not supported | \`UNSU\` | - | | Used to apply amount rules | \`TEST\` | - | > NOTE > > > To test more than one scenario, you must repeat the payment method tokenization process, making sure to fill in the cardholder data according to the scenario to test. ::: :::AccordionComponent{title="Register payment method" pill="2"} Continue registering the tokenized test card in your system, following the steps according to the business model your integration adapts to. You must use your :toolTipComponent\[test Access Token\]{content="Private key of the application created in Mercado Pago, which is used in the \_backend\_. You can access it through \*Your integrations > Application details > Tests > Test credentials\*."} in all requests and use the value \`test@testuser.com\` as the customer email. \* \[Registration with a first payment with CVV\](https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/register-first-payment) \* \[Registration for future payments\](https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/register-future-payment) > NOTE > > If you tokenized more than one test card to test different scenarios, you must register each of them. ::: :::::AccordionComponent{title="Process an automatic test payment" pill="3"} With the \`customer\_id\` and \`payment\_profile\_id\` generated in the previous stage, you can now process an automatic test payment. Send a \*\*POST\*\* to the endpoint \[/v1/orders\](https://www.mercadopago.com.ar/developers/en/reference/online-payments/checkout-api/create-order/post) including your :toolTipComponent\[test Access Token\]{content="Private key of the application created in Mercado Pago, which is used in the \_backend\_. You can access it through \*Your integrations > Application details > Tests > Test credentials\*."} and following the detailed instructions for each payment type. ::::TabsComponent :::TabComponent{title="One-time payments with saved card"} \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/orders' \\ -H 'Content-Type: application/json' \\ -H 'X-Idempotency-Key: UNIQUE\_IDEMPOTENCY\_KEY' \\ -H 'Authorization: Bearer TEST-ACCESS\_TOKEN' \\ -d '{ "type": "online", "processing\_mode": "automatic", "total\_amount": "100.00", "external\_reference": "test-order-001", "payer": { "customer\_id": "CUSTOMER\_ID" }, "transactions": { "payments": \[ { "amount": "100.00", "automatic\_payments": { "payment\_profile\_id": "PAYMENT\_PROFILE\_ID" }, "stored\_credential": { "payment\_initiator": "merchant", "reason": "card\_on\_file", "first\_payment": true } } \] } }' \`\`\` | Parameter | Type | Description | Required | | :--- | :--- | :--- | :--- | | \`type\` | String | Order type. Must be \`online\`. | Required | | \`external\_reference\` | String | External reference of the order. Maximum 64 alphanumeric characters, hyphens (-) and underscores (\_). | Required | | \`total\_amount\` | String | Total amount of the transaction. | Required | | \`payer.customer\_id\` | String | Customer identifier, obtained in step 2\. | Required | | \`transactions.payments.amount\` | String | Transaction amount. | Required | | \`automatic\_payments.payment\_profile\_id\` | String | Payment profile identifier, obtained in step 2\. | Required | | \`stored\_credential.payment\_initiator\` | String | Indicates who initiates the transaction. Use \`merchant\` for MIT payments or \`customer\` for CIT payments. | Required | | \`stored\_credential.reason\` | String | Payment reason. For one-time payments with saved card, use \`card\_on\_file\`. | Optional | | \`stored\_credential.first\_payment\` | Boolean | Indicates if it is the first payment (\`true\`) or a subsequent payment (\`false\`). | Optional | | \`stored\_credential.previous\_transaction\_reference\` | String | Reference code of the previous transaction. | Required when \`first\_payment\` is \`false\` | ::: :::TabComponent{title="Scheduled recurring payments"} \`\`\`curl curl -X POST \\ 'https://api.mercadopago.com/v1/orders' \\ -H 'Content-Type: application/json' \\ -H 'X-Idempotency-Key: UNIQUE\_IDEMPOTENCY\_KEY' \\ -H 'Authorization: Bearer TEST-ACCESS\_TOKEN' \\ -d '{ "type": "online", "processing\_mode": "automatic\_async", "total\_amount": "100.00", "external\_reference": "subscription-test-001", "payer": { "customer\_id": "CUSTOMER\_ID" }, "transactions": { "payments": \[ { "amount": "100.00", "automatic\_payments": { "payment\_profile\_id": "PAYMENT\_PROFILE\_ID", "retries": 3, "subscription": { "id": "subscription-id-001", "sequence": { "number": 1, "total": 12 }, "invoice": { "id": "invoice-001", "billing\_date": "2025-01-07", "period": { "interval": 1, "type": "monthly" } } } }, "stored\_credential": { "payment\_initiator": "merchant", "reason": "recurring", "first\_payment": true } } \] } }' \`\`\` | Parameter | Type | Description | Required | | :--- | :--- | :--- | :--- | | \`type\` | String | Order type. Must be \`online\`. | Required | | \`external\_reference\` | String | External reference of the order. Maximum 64 alphanumeric characters, hyphens (-) and underscores (\_). | Required | | \`total\_amount\` | String | Total amount of the transaction. | Required | | \`processing\_mode\` | String | Processing mode. Use \`automatic\_async\` to enable automatic retries. | Required for recurrence | | \`payer.customer\_id\` | String | Customer identifier, obtained in step 2\. | Required | | \`transactions.payments.amount\` | String | Transaction amount. | Required | | \`automatic\_payments.payment\_profile\_id\` | String | Payment profile identifier, obtained in step 2\. | Required | | \`automatic\_payments.retries\` | Integer | Number of retries in case of failure (between 1 and 5). Only allowed with \`automatic\_async\`. | Optional | | \`automatic\_payments.subscription.id\` | String | Subscription identifier. | Required if \`sequence\_control\` is \`manual\` | | \`automatic\_payments.subscription.sequence.number\` | Integer | Payment number in the sequence. | Required if \`sequence\_control\` is \`manual\` | | \`automatic\_payments.subscription.sequence.total\` | Integer | Total payments in the subscription. Use \`null\` for permanent subscriptions. | Required if \`sequence\_control\` is \`manual\` | | \`automatic\_payments.subscription.invoice.id\` | String | Invoice identifier for the billing cycle. | Required if \`sequence\_control\` is \`manual\` | | \`automatic\_payments.subscription.invoice.billing\_date\` | String | Billing date of the cycle (YYYY-MM-DD format). | Required if \`sequence\_control\` is \`manual\` | | \`automatic\_payments.subscription.invoice.period.interval\` | Number | Time interval between each charge. | Required if \`sequence\_control\` is \`manual\` | | \`automatic\_payments.subscription.invoice.period.type\` | String | Period type: \`daily\`, \`weekly\` or \`monthly\`. | Required if \`sequence\_control\` is \`manual\` | | \`stored\_credential.payment\_initiator\` | String | Indicates who initiates the transaction. Use \`merchant\` for MIT payments. | Required | | \`stored\_credential.reason\` | String | Payment reason. For recurrence, use \`recurring\`. | Optional | | \`stored\_credential.first\_payment\` | Boolean | Indicates if it is the first payment (\`true\`) or a subsequent payment (\`false\`). | Optional | | \`stored\_credential.previous\_transaction\_reference\` | String | Reference code of the previous transaction. | Required when \`first\_payment\` is \`false\` | > NOTE > > If the payment profile has \`sequence\_control\` configured as \`auto\` and you send \`stored\_credential.reason: recurring\`, it is not necessary to send the \`subscription\` node since the recurrence information will be automatically managed by the system. ::: :::: If you want to test another payment scenario, repeat the request making sure to include the data associated with the second tokenized test card. ::::: :::AccordionComponent{title="Verify the result" pill="4"} To verify that the test payment was processed correctly, send a \*\*GET\*\* to the endpoint :TagComponent{tag="API" text="/v1/orders/{id}" href="/developers/en/reference/online-payments/checkout-api/get-order/get"} replacing \`{id}\` with the order identification received in the response from the previous step. The response should show the payment status selected when entering the test cardholder data. \`\`\`json { "id": "ORD01JS2V6CM8KJ0EC4H502TGK1WP", "type": "online", "processing\_mode": "automatic", "status": "processed", "status\_detail": "accredited", "total\_amount": "100.00", "transactions": { "payments": \[ { "id": "PAY01JS2V6CM8KJ0EC4H504R7YE34", "amount": "100.00", "status": "processed", "status\_detail": "accredited" } \] } } \`\`\` Additionally, you can verify that you received the \[Webhook notification\](https://www.mercadopago.com.ar/developers/en/docs/automatic-payments-orders/notifications) with the order data. :::