# Update a transaction from the order This endpoint allows updating the information of a payment transaction in the order. **PUT** `/v1/orders/{order_id}/transactions/{transaction_id}` ## Request parameters ### Header - `X-Idempotency-Key` (string, required) This feature allows you to safely retry requests without the risk of accidentally performing the same action more than once. This is useful for avoiding errors, such as creating two identical payments. To ensure that each request is unique, it's important to use an exclusive value in the header of your request. We suggest using a UUID V4 or random strings. The header accepts values between 1 and 64 characters. ### Path - `order_id` (string, required) ID of the order that is being updated. This value is returned in the response to the 'Create order' ("/v1/orders") request. - `transaction_id` (string, required) Identifier of the payment transaction that will be updated in the order. This ID is automatically generated by Mercado Pago when the request is created or when the transaction is added later to the order. - `payment_method` (object, optional) Information about the payment method. Access the endpoint "/v1/payment_methods" to check all available payment methods and get a list with the details of each one and their properties. The requirement of this parameter varies according to the need to send its attributes in the request. Depending on the payment method you are integrating, check below which of these attributes are required. - `payment_method.id` (string, optional) Identifier of the payment method selected to make the payment. If it's a "card" payment, it will show the brand. Possible enum values: - `visa` "Visa credit" card. - `master` "Master credit" card. - `debmaster` "Master debit" card. - `debvisa` "Visa debit" card. - `rapipago` "Rapipago" payment. - `pagofacil` "Pago fácil" payment. - `payment_method.type` (string, optional) Type of payment method selected to make the payment. Possible enum values: - `credit_card` Credit card. - `debit_card` Debit card. - `ticket` Cash payment. - `payment_method.token` (string, optional) Token that identifies the card and contains its data securely. Only required for "card" payments. It has a minimum length of 32 characters, and a maximum length of 33. If you don't know how to generate it, go to the "card" payment configuration in the Checkout API documentation. - `payment_method.installments` (integer, optional) Number of installments selected. - `payment_method.statement_descriptor` (string, optional) Description that the payment will appear with in the card statement. Accepts up to 50 characters. ## Response parameters - `payment_method` (object, optional) Information about the payment method. Access the endpoint "/v1/payment_methods" to check all available payment methods and get a list with the details of each one and their properties. The requirement of this parameter varies according to the need to send its attributes in the request. Depending on the payment method you are integrating, check below which of these attributes are required. - `payment_method.id` (string, optional) Identifier of the payment method selected to make the payment. If it's a "card" payment, it will show the brand. Possible enum values: - `visa` "Visa credit" card. - `master` "Master credit" card. - `debmaster` "Master debit" card. - `debvisa` "Visa debit" card. - `rapipago` "Rapipago" payment. - `pagofacil` "Pago fácil" payment. - `payment_method.type` (string, optional) Type of payment method selected to make the payment. Possible enum values: - `credit_card` Credit card. - `debit_card` Debit card. - `ticket` Cash payment. - `payment_method.token` (string, optional) Token that identifies the card and contains its data securely. Only required for "card" payments. It has a minimum length of 32 characters, and a maximum length of 33. If you don't know how to generate it, go to the "card" payment configuration in the Checkout API documentation. - `payment_method.installments` (integer, optional) Number of installments selected. - `payment_method.statement_descriptor` (string, optional) Description that the payment will appear with in the card statement. Accepts up to 50 characters. ## Errors | Status | Error | Description | | ------- | ------- | ----------- | | 400 | empty_required_header | The "X-Idempotency-Key" header is required and was not sent. Make the requisition again including it. | | 400 | invalid_idempotency_key_length | The value sent in the "X-Idempotency-Key" header exceeded the allowed size. The header accepts values between 1 and 64 characters. | | 400 | invalid_path_param | The "order_id" provided in the request path is not correct. Please confirm it and provide a valid ID to try again. | | 400 | invalid_transaction_id | The "transaction_id" provided in the request path is not correct. Please confirm it and provide a valid ID to try again. | | 401 | 401 | The value sent as Access Token is incorrect. Please check and try again with the correct value. | | 401 | invalid_credentials | There is no support for test credentials. Use test users with production credentials for the sandbox environment and your production credentials for the production environment. | | 404 | order_not_found | Order not found. Please check if you provided the correct order ID. | | 409 | idempotency_key_already_used | The value sent as the idempotency header ("X-Idempotency-Key") has already been used. Please try the request again sending a new value. | | 500 | internal_error | Generic error. Please try submitting the request again. | ## Request example ### cURL ```bash curl -X PUT \ 'https://api.mercadopago.com/v1/orders/{order_id}/transactions/{transaction_id}' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -d '{ "payment_method": { "id": "master", "type": "credit_card", "token": "12345", "installments": 1, "statement_descriptor": "My Store" } }' ``` ## Response example ```json { "payment_method": { "id": "master", "type": "credit_card", "token": "12345", "installments": 1, "statement_descriptor": "My Store" } } ```