# Update payment Renew the details of a payment when you need it. Indicate the payment ID and send the parameters with the information you want to update. **PUT** `/v1/payments/{id}` ## Request parameters ### Path - `id` (number, required) Unique Payment Identifier, automatically generated by Mercado Pago. - `capture` (boolean, optional) It is a boolean field found in two-step payments (like debit card). In this type of payment, which is carried out asynchronously, the purchase value is first reserved (capture = false). This amount is captured and not debited from the account instantly. When the money is actually transferred to the collector (who receives the payment) the amount is captured (capture = true). This attribute is available exclusively for cards of the Visa and Mastercard brands and is compatible only with the Bancolombia and BBVA banks. - `date_of_expiration` (string, optional) Payment’s expiration date. The valid format of the attribute is as follows - "yyyy-MM-dd'T'HH:mm:ssz". Ex - 2022-11-17T09:37:52.000-04:00. - `status` (string, optional) It is the current state of payment. It can be two following types. Possible enum values: - `pending` The user has not concluded the payment process (for example, to generate a payment by boleto, this payment will be concluded at the moment in which the user makes the non-corresponding payment selected); - `approved` The payment was approved and credited; - `authorized` The payment was authorized, but still was not captured; - `in_process` The payment is in analysis; - `in_mediation` The user started a dispute; - `rejected` The payment was rejected. (The user can try the payment again); - `cancelled` Either the payment was cancelled by one of the parties or the payment expired; - `refunded` The payment was returned to the user; - `charged_back` A chargeback was placed on the buyer's credit card. - `transaction_amount` (number, optional) Product’s cost. The field can contain two decimal places or none. ## Response parameters - `id` (number, optional) Unique Payment Identifier, automatically generated by Mercado Pago. - `date_created` (string, optional) Payment creation date. - `date_approved` (string, optional) Payment approval date. A payment can be generated in an intermediate state and then approved, so the creation date will not always coincide with the Approval Date. - `date_last_updated` (string, optional) Date on which the last payment event was recorded. - `date_of_expiration` (string, optional) Payment’s expiration date. The attribute’s valid format is as follows - "yyyy-MM-dd'T'HH:mm:ssz". Ex. - 2022-11-17T09:37:52.000-04:00. - `money_release_date` (string, optional) Date on which the payment is settled and the money is made available in the Mercado Pago account of the Collector (the one who receives the payment). The field can take on the values “pending” or “released”, where the first indicates that the payment has not yet been released (money held for a period) and “released” means that the money has already been released to the user's available balance. - `operation_type` (string, optional) Indicates the type of payment. The available types are as follows. Possible enum values: - `investment` When funds are invested in products like CDB within the Mercado Pago app; - `regular_payment` Default classification for a purchase paid through Mercado Pago. - `money_transfer` Transfer of funds between two users. - `recurring_payment` Automatic payment for recurring charges from an active subscription. - `account_fund` Deposit of money into the user's account. - `payment_addition` Adding funds to an existing payment via a Mercado Pago account. - `cellphone_recharge` Reloading a user's cellphone account. - `pos_payment` Payment processed through a Point of Sale terminal. - `money_exchange` Currency exchange transaction for a user. - `issuer_id` (string, optional) Is the identifier of the card issuer being used in a credit or debit card payment. - `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: - `PSE` Digital payment method which users authorize the debit of funds from their bank through virtual banking, your savings, checking or electronic deposit accounts. - `payment_type_id` (string, optional) Type of payment method selected to make the payment. Possible enum values: - `ticket` Cash payment. - `bank_transfer` Bank transfer. - `credit_card` Payment by credit card. - `debit_card` Payment by debit card. - `prepaid_card` Payment by prepaid card. - `digital_wallet` Paypal. - `crypto_transfer` Payment with cryptocurrencies such as Ethereum and Bitcoin. - `status` (string, optional) It is the payment’s current state. It can be of the following types. Possible enum values: - `pending` The user has not yet completed the payment process (e.g., after generating a boleto, the payment will be completed when the user pays at the selected location). - `approved` The payment has been successfully approved and credited. - `authorized` The payment has been authorized but is not yet captured. - `in_process` The payment is currently under review. - `in_mediation` The user has initiated a dispute. - `rejected` The payment was rejected (the user may attempt to pay again). - `cancelled` The payment was either cancelled by a party or expired. - `refunded` The payment was refunded to the user. - `charged_back` A chargeback was issued on the buyer's credit card. - `status_detail` (string, optional) Detail in which the Collection resulted. Possible enum values: - `partially_refunded` The payment has at least one partial refund. - `refunded` The payment has been refunded by the collector. - `currency_id` (string, optional) Identifier of the currency used in the payment. - `description` (string, optional) Purchased product’s description, the reason for payment. E.g. - "Xiaomi Redmi Note 11S mobile phone 128gb 6gb Ram Original Global Blue Version" (description of a product in the marketplace). - `live_mode` (boolean, optional) Indicates whether the payment was made in a production environment or in a test environment. If TRUE, then the chargeback will be processed in production mode. If FALSE, then the chargeback will be processed in sandbox mode. - `sponsor_id` (string, optional) This field is deprecated and no longer in use. - `authorization_code` (string, optional) Transaction’s authorization code for payments with “payment_method_type” of type “credit_card” (credit card), “debit_card” (debit card) and “voucher_card” (voucher card for benefits, such as Alelo). In summary, this code is used for card transactions. The code is numerical and has 6 digits. - `money_release_schema` (string, optional) This field is used to identify whether a payment is PNF (Payment in Flow). Payment in flow is a form of cash release in which the installments received by a seller are released over the months (which corresponds to the number of installments). Possible values ​​for this field are “null” or “payment_in_flow”. - `taxes_amount` (number, optional) Corresponds to the tax values ​​calculated for the payment. - `counter_currency` (string, optional) Basically, it is an object that will allow you to convert payments of the CBT (Cross Border Trade) type into dollars, which are international payments made in foreign currency. - `shipping_amount` (number, optional) Amount of charge for shipping the purchase. It is of type BigDecimal. - `pos_id` (string, optional) Point of Sale (POS) digital identifier. They are physical points of sale that use a card machine for sales. - `store_id` (string, optional) Store identifier to which the point of sale belongs. - `collector_id` (number, optional) It is the user who receives the money. Ex - A user (payer) buys a cell phone through the marketplace. The identifier of the store/seller to receive the payment is the collector_id. - `payer` (object, optional) Payer information. - `payer.id` (number, optional) Payer identifier generated by Mercado Pago. - `payer.email` (string, optional) Email associated with the payer. This value will only return a response when status=approved, status=refunded, or status=charged_back. - `payer.identification` (object, optional) Payer's personal identification. - `payer.identification.number` (string, optional) Payer's identification document number. - `payer.identification.type` (string, optional) Payer's identification document type. Access the endpoint '/v1/identification_type' to check all available identification types by country and get a list with the details of each one and their properties. - `payer.type` (string, optional) Identification type of the associated payer (mandatory if the payer is a customer). Possible enum values: - `customer` The payer is a registered customer and is associated with the collector. - `guest` The payer does not have an account. - `metadata` (object, optional) This is an optional key-value object where the customer can add additional information that needs to be recorded at checkout. Ex - {"payments_group_size":1,"payments_group_timestamp":"2022-11-18T15:01:44Z","payments_group_uuid":"96cfd2a4-0b06-4dea-b25f-c5accb02ba10"}. - `additional_info` (object, optional) Additional information. - `additional_info.items` (array, optional) List of items to be paid. - `additional_info.items[].id` (string, optional) It is the purchased product ad identifier. Ex - “MLB2907679857”. - `additional_info.items[].title` (string, optional) Item name. - `additional_info.items[].description` (string, optional) Long item description. - `additional_info.items[].picture_url` (string, optional) Image URL. - `additional_info.items[].category_id` (string, optional) Category of the item. - `additional_info.items[].quantity` (number, optional) Item quantity. - `additional_info.items[].unit_price` (number, optional) Unit price of the purchased item. - `additional_info.payer` (object, optional) The payer is the one who makes the payment. This field is an object that has the payer's information. - `additional_info.payer.registration_date` (string, optional) Date of registration of the buyer on your site. - `additional_info.shipments` (object, optional) Shipping information. - `additional_info.shipments.receiver_address` (object, optional) Buyer's address. - `additional_info.shipments.receiver_address.street_name` (string, optional) Street where the buyer lives. - `additional_info.shipments.receiver_address.street_number` (number, optional) Number of the property where the buyer lives. If you do not have a number, send "N/A" - `additional_info.shipments.receiver_address.zip_code` (string, optional) Buyer's zip code. - `additional_info.shipments.receiver_address.city_name` (string, optional) Name of the city where the buyer's address is located. - `additional_info.shipments.receiver_address.state_name` (string, optional) Name of the State where the buyer's address is located. - `external_reference` (string, optional) It is a payment’s external reference. It could be, for example, a hashcode from the Central Bank, working as a transaction origin identifier. - `transaction_amount` (number, optional) Product’s cost. - `transaction_amount_refunded` (number, optional) Transaction amount refunded. - `coupon_amount` (number, optional) It is the value of the discount coupon. The attribute's type is BigDecimal. - `differential_pricing_id` (string, optional) Attribute that commonly contains an agreement on how much the user will be charged (generally, this field is more relevant for Marketplace payments). Pricing and fees are calculated based on this identifier. - `deduction_schema` (string, optional) Pricing Scheme applied by Mercado Pago. It is a field that represents the information of a type of financing (installment). Ex. - “ahora12” is a schema that indicates that the payment is divided into 12 installments. In addition, financing may have an additional cost, such cost being included in that same answer and pointed out to whom this applies (payer/collector). - `transaction_details` (object, optional) Transaction details. - `transaction_details.payment_method_reference_id` (string, optional) Unique identifier of the payment method. - `transaction_details.net_received_amount` (number, optional) Net amount received. - `transaction_details.total_paid_amount` (number, optional) Total amount charged to the payer. - `transaction_details.overpaid_amount` (number, optional) Overpaid amount. - `transaction_details.external_resource_url` (string, optional) External resource URL. - `transaction_details.installment_amount` (number, optional) Amount of the chosen financing fee. - `transaction_details.financial_institution` (string, optional) Financial institution. - `transaction_details.payable_deferral_period` (string, optional) Payment deferral period. - `transaction_details.acquirer_reference` (string, optional) Acquirer reference. - `fee_details` (array, optional) Fee detail. - `fee_details[].type` (string, optional) Fee detail. Possible enum values: - `mercadopago_fee` Fee for using Mercado Pago. - `coupon_fee` Discount applied using a coupon. - `financing_fee` Cost of financing. - `shipping_fee` Cost of shipping. - `application_fee` Marketplace commission for the service. - `discount_fee` Discount offered by the seller through cost absorption. - `fee_details[].amount` (number, optional) Fee amount. - `fee_details[].fee_payer` (string, optional) Who absorbs the cost. Possible enum values: - `collector` The seller covers the cost. - `payer` The buyer covers the cost. - `captured` (boolean, optional) Indicates if the payment amount was captured or is pending capture. - `binary_mode` (boolean, optional) When set to TRUE, payments can only be approved or rejected. Otherwise they can also result in_process. - `call_for_authorize_id` (string, optional) Identifier that is provided to the issuing bank so that payments can be authorized. - `statement_descriptor` (string, optional) Description that the payment will appear with in the card statement (eg MERCADOPAGO). - `installments` (number, optional) Number of installments selected. - `card` (object, optional) Card details.For security reasons, sensitive card data is not exposed in the response. - `card.id` (string, optional) Card ID. - `card.first_six_digits` (string, optional) Card Bin. - `card.last_four_digits` (string, optional) Last 4 digits of the card. - `card.expiration_month` (number, optional) Card's expiration month. - `card.expiration_year` (number, optional) Card's expiration year. - `card.date_created` (string, optional) Card registration date. - `card.date_last_updated` (string, optional) Date on which the last payment event was recorded. - `card.cardholder` (object, optional) Cardholder details. - `card.cardholder.name` (string, optional) Name. - `card.cardholder.identification` (object, optional) Payer's personal identification. - `card.cardholder.identification.number` (string, optional) Payer's identification document number. - `card.cardholder.identification.type` (string, optional) Payer's identification document type. Access the endpoint '/v1/identification_type' to check all available identification types by country and get a list with the details of each one and their properties. - `notification_url` (string, optional) Notifications URL available to receive notifications of events related to Payment. The maximum number of characters allowed for submission in this parameter is 248 characters. - `processing_mode` (string, optional) Processing mode. There are two types. Possible enum values: - `Aggregator` The merchant will use the Mercado Pago merchant codes and will take advantage of the financial advantages that we offer. - `Gateway` For the merchant it is necessary to have their own merchant codes for online sales and to have an agreement with each of the desired means of payment. - `merchant_account_id` (string, optional) Merchant store code identifier. Applies only to the gateway model (since the delivery of money to the merchant does not go through the Mercado Pago system). - `acquirer` (string, optional) Acquirer. - `merchant_number` (string, optional) Merchant number (Applies to gateway model). - `point_of_interaction` (object, optional) Information from the application that processes the payment and receives regulatory data. - `point_of_interaction.type` (string, optional) Payment type identifier. - `point_of_interaction.sub_type` (string, optional) Secondary identifier of the payment type. - `point_of_interaction.application_data` (object, optional) Information about the application that processes the payment. - `point_of_interaction.application_data.name` (string, optional) Application name. - `point_of_interaction.application_data.version` (string, optional) Current version. - `point_of_interaction.transaction_data` (object, optional) Information on the pending payment that was generated. - `point_of_interaction.transaction_data.qr_code_base64` (string, optional) Base64 representation of the image of the QR code to be scanned to finalize the payment. - `point_of_interaction.transaction_data.ticket_url` (string, optional) Link to the rendered Pix, with QR codes and instructions to pay. ## Errors | Status | Error | Description | | ------- | ------- | ----------- | | 400 | 8 | The name of the parameters is wrong | | 400 | 1004 | Invalid parameters for payment_method API | | 400 | 2018 | The action requested is not valid for the current payment state. | | 400 | 2078 | Capture attribute must be boolean. | | 400 | 2079 | Invalid value for capture attribute. | | 403 | 4 | The caller is not authorized to access this resource. | | 403 | 3002 | The caller is not authorized to perform this action. | | 404 | 2000 | Payment not found. | ## Request example ### cURL ```bash curl -X PUT \ 'https://api.mercadopago.com/v1/payments/{id}' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -d '{ "capture": true, "date_of_expiration": "string", "status": "cancelled", "transaction_amount": "24.50" }' ``` ### Node.js ```javascript const client = new MercadoPago({ accessToken: config.access_token }); const payment = new Payment(client); payment.capture({ id: '', requestOptions: { idempotencyKey: '' } }).then(console.log).catch(console.log); ``` ### PHP ```php setCustomHeaders(["X-Idempotency-Key: "]); $client = new PaymentClient(); $id = ""; $payment = $client->capture($id, $request_options); ?> ``` ### Python ```python import mercadopago sdk = mercadopago.SDK("ENV_ACCESS_TOKEN") request_options = mercadopago.config.RequestOptions() request_options.custom_headers = { 'x-idempotency-key': '' } update_request = { "capture": False, "transaction_amount": 58.8 } request = self.sdk.payment().update(123, update_request, request_options) print(request) ``` ### Java ```java MercadoPagoConfig.setAccessToken("YOUR_ACCESS_TOKEN"); Map customHeaders = new HashMap<>(); customHeaders.put("x-idempotency-key", ""); MPRequestOptions requestOptions = MPRequestOptions.builder() .customHeaders(customHeaders) .build(); PaymentClient client = new PaymentClient(); Long paymentId = ""; client.capture(paymentId, customHeaders); ``` ### .Net ```csharp MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN"; var requestOptions = new RequestOptions(); requestOptions.CustomHeaders.Add("x-idempotency-key", ""); var client = new PaymentClient(); Payment payment = await client.CaptureAsync("", requestOptions); ``` ### Ruby ```text require 'mercadopago' sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN') custom_headers = { 'x-idempotency-key': '' } custom_request_options = Mercadopago::RequestOptions.new(custom_headers: custom_headers) update_request = { capture: false, transaction_amount: 58.8 } payment_response = sdk.payment.update(123, update_request, custom_request_options) payment_response[:response] ``` ## Response example ```json { "id": 20359978, "date_created": "2019-07-10T14:47:58.000Z", "date_approved": "2019-07-10T14:47:58.000Z", "date_last_updated": "2019-07-10T14:47:58.000Z", "date_of_expiration": "string", "money_release_date": "2019-07-24T14:47:58.000Z", "operation_type": "investment", "issuer_id": 25, "payment_method_id": "master", "payment_type_id": "credit_card", "status": "approved", "status_detail": "accredited", "currency_id": "COP", "description": "Pago Pizza", "live_mode": false, "sponsor_id": "string", "authorization_code": "string", "money_release_schema": "string", "taxes_amount": 0, "counter_currency": "string", "shipping_amount": 0, "pos_id": "string", "store_id": "string", "collector_id": 448876418, "payer": { "id": 123, "email": "test_payer@example.com", "identification": { "number": "123456789-0", "type": "NIT" }, "type": "customer" }, "metadata": {}, "additional_info": { "items": [ { "id": "PR0001", "title": "Point Mini", "description": "Producto Point para cobros con tarjetas mediante bluetooth", "picture_url": "https://http2.mlstatic.com/resources/frontend/statics/growth-sellers-landings/device-mlb-point-i_medium2x.png", "category_id": "electronics", "quantity": 1, "unit_price": "24.50" } ], "payer": { "registration_date": "2019-01-01T15:01:01.000Z" }, "shipments": { "receiver_address": { "street_name": "Av das Nacoes Unidas", "street_number": "93-09", "zip_code": "110221", "city_name": "Bogotá", "state_name": "Bogotá D.C." } } }, "external_reference": "MP0001", "transaction_amount": "24.50", "transaction_amount_refunded": 0, "coupon_amount": 0, "differential_pricing_id": "string", "deduction_schema": "string", "transaction_details": { "payment_method_reference_id": "string", "net_received_amount": 56, "total_paid_amount": "50.00", "overpaid_amount": 0, "external_resource_url": "string", "installment_amount": 58, "financial_institution": "string", "payable_deferral_period": "string", "acquirer_reference": "string" }, "fee_details": [ { "type": "coupon_fee", "amount": 2, "fee_payer": "payer" } ], "captured": false, "binary_mode": false, "call_for_authorize_id": "string", "statement_descriptor": "MercadoPago", "installments": 1, "card": { "id": null, "first_six_digits": null, "last_four_digits": null, "expiration_month": null, "expiration_year": null, "date_created": "2019-07-10T14:47:58.000Z", "date_last_updated": "2019-07-10T14:47:58.000Z", "cardholder": { "name": null, "identification": { "number": "123456789-0", "type": "NIT" } } }, "notification_url": "https://www.suaurl.com/notificacoes/", "processing_mode": "aggregator", "merchant_account_id": "string", "acquirer": "string", "merchant_number": "string", "point_of_interaction": { "type": "master", "sub_type": "string", "application_data": { "name": "NAME_SDK", "version": "VERSION_NUMBER" }, "transaction_data": { "qr_code_base64": "iVBORw0KGgoAAAANSUhEUgAABRQAAAUUCAYAAACu5p7oAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAIABJREFUeJzs2luO3LiWQNFmI+Y/Zd6vRt36KGNXi7ZOBtcagHD4kNLeiLX33v8DAAAAABD879sDAAAAAAA/h6AIAAAAAGSCIgAAAACQCYoAAAAAQCYoAgAAAACZoAgAAAAAZIIiAAAAAJAJigAAAABAJigCAAAAAJmgCAAAAABkgiIAAAAAkAmKAAAAAEAmKAIAAAAAmaAIAAAAAGSCIgAAAACQCYoAAAAAQCYoAgAAAACZoAgAAAAAZIIiAAAAAJAJigAAAABAJigCA...", "ticket_url": "https://www.mercadopago.com.br/payments/123456789/ticket?caller_id=123456&hash=123e4567-e89b-12d3-a456-426655440000" } } } ```