# Payment Confirmation import ResponseCodes from './codigos-de-resposta.md'; import ApiDoc from '../../../../../src/components/api-doc/ApiDoc'; After creating and authorizing a payment pending confirmation, the merchant must call the confirmation service to confirm or undo the payment using the same NIT obtained on the first step of the flow. ## Call details - **Resource:** `/v1/payments/{nit}` - **HTTP Method:** `PUT` - **Request format:** `query string` - **Response format:** `JSON` - **Header parameters:** [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Format", "h-3": "Mandatory", "0-0": "`merchant_id`", "0-1": "Merchant code on Carat Portal. The production and certification codes will be different.", "0-2": "\\< 15 AN", "0-3": "YES", "1-0": "`merchant_key`", "1-1": "Merchant authentication key on Carat Portal. The production and certification keys will be different.", "1-2": "\\< 80 AN", "1-3": "YES" }, "cols": 4, "rows": 2, "align": [ null, null, null, null ] } [/block] ## Examples Below is an example of the payment confirmation service call using the **cURL** tool. **Request:** To use this example, don't forget to define the variable `{{url}}` with the value
**** ```bash curl --request PUT "https://{{url}}/e-sitef/api/v1/payments/1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr?confirm=true" --header "merchant_id: xxxxxxxxxxx" --header "merchant_key: xxxxxxxxxxx" --verbose ``` **Response:** ```json { "code": "0", "message": "OK. Transaction successful.", "payment": { "status": "CON" } } ``` ## Request parameters The table below describes the request parameters of the payment confirmation service: [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Format", "h-3": "Mandatory", "0-0": "`confirm`", "0-1": "This field must be sent with the value `true` if you want to confirm the transaction, or `false`, if you want to undo it.", "0-2": "\\< 5 T/F", "0-3": "YES", "1-0": "`amount`", "1-1": "Amount to be captured. It must be less than or equal to the authorized amount. Partial confirmations are only supported by non-SiTef routings. If this field is not sent, the total transaction amount is used.", "1-2": "\\< 12 N", "1-3": "NO" }, "cols": 4, "rows": 2, "align": [ null, null, null, null ] } [/block] ## Response parameters If successful, the HTTP response code will be `200`. Any other code must be interpreted as an error. The table below describes the response parameters of the payment confirmation service: [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Format", "0-0": "`code`", "0-1": "Carat Portal response code. Any code different from `0` means failure. [Learn more.](codigos-da-api.md#response-codes)", "0-2": "\\< 4 N", "1-0": "`message`", "1-1": "Carat Portal response message.", "1-2": "\\< 500 AN", "2-0": "**payment**", "2-1": "", "2-2": "", "3-0": "`status`", "3-1": "Status of the payment transaction on Carat Portal. [Learn more.](codigos-da-api.md#transaction-status)", "3-2": "= 3 AN", "4-0": "`host_usn`", "4-1": "Host USN.", "4-2": "\\< 15 AN", "5-0": "`payment_date`", "5-1": "Payment authorization date on Carat Portal in `DD/MM/YYYY'T'HH:mm` format. Example: 13/07/2017T16:03", "5-2": "= 16 D" }, "cols": 3, "rows": 6, "align": [ null, null, null ] } [/block]