Criar pagamento - Pagamentos - Mercado Pago Developers
Qual documentação você quer buscar?

Não sabe como começar a integrar? 

Acesse os primeiros passos
Criar pagamento

POST

https://api.mercadopago.com/v1/payments
Crie um pagamento e acrescente todas as informações que você precisa. Certifique-se de acrescentar os detalhes do pagamento e os detalhes do cliente.
Parâmetros de requisição
HEADER
X-Idempotency-Key
string
Esta função permite repetir solicitações de forma segura, sem o risco de realizar a mesma ação mais de uma vez por engano. Isso é útil para evitar erros, como a criação de dois pagamentos idênticos, por exemplo. Para gar...Ver más
BODY
additional_info
object
No nível de Pagamentos, são apenas dados e apenas encaminhamos essas informações para outras APIS, como Risco, para realizar pontuação e prevenir fraudes, para Impostos para determiná-los para pagamentos internacionais.
application_fee
number
Comissão (taxa) que terceiros (integradores) cobram de seus clientes, neste caso, vendedores, pelo uso da plataforma do marketplace e de outros serviços. Esse é um valor em reais a ser definido pelo integrador ao vendedo...Ver más
binary_mode
boolean
Quando definido como TRUE, os pagamentos só podem ser aprovados ou rejeitados. Caso contrário, eles também podem resultar in_process.
callback_url
string
URL para a qual o Mercado Pago faz o redirecionamento final (apenas para transferência bancária).
Parâmetros de resposta
id
number
Identificador único de pagamento, gerado automaticamente pelo Mercado Pago
date_created
string
Data de criação do pagamento.
date_approved
string
Data de aprovação do pagamento. Um pagamento pode ser gerado em um estado intermediário e depois aprovado, portanto, a data de criação nem sempre coincidirá com a Data de Aprovação.
date_last_updated
string
Data em que o último evento de pagamento foi registrado.
Erros

400Erro

1

Params Error.

3

Token must be for test.

5

Must provide your access_token to proceed.

23

The following parameters must be valid date and format (yyyy-MM-dd'T'HH:mm:ssz) date_of_expiration.

1000

Number of rows exceeded the limits.

1001

Date format must be yyyy-MM-dd'T'HH:mm:ss.SSSZ.

2001

Already posted the same request in the last minute.

2002

Customer not found.

2004

POST to Gateway Transactions API fail.

2006

Card Token not found.

2007

Connection to Card Token API fail.

2009

Card token issuer can't be null.

2034

Invalid users involved 2041 – GET to API APPLICATION fail.

2060

The customer can't be equal to the collector.

2062

Invalid card token.

2072

Invalid value for transaction_amount.

2077

Deferred capture not supported.

2123

Invalid operators users involved.

2131

Cannot infer Payment Method.

3000

You must provide your cardholder_name with your card data.

3001

You must provide your cardissuer_id with your card data.

3003

Invalid card_token_id.

3004

Invalid parameter site_id.

3005

Not valid action, the resource is in a state that does not allow this operation. For more information see the state that has the resource.

3006

Invalid parameter cardtoken_id.

3007

The parameter client_id can not be null or empty.

3008

Not found Cardtoken.

3009

unauthorized client_id.

3010

Not found card on whitelist.

3011

Not found payment_method.

3012

Invalid parameter security_code_length.

3013

The parameter security_code is a required field can not be null or empty.

3014

Invalid parameter payment_method.

3015

Invalid parameter card_number_length.

3016

Invalid parameter card_number.

3017

The parameter card_number_id can not be null or empty.

3018

The parameter expiration_month can not be null or empty.

3019

The parameter expiration_year can not be null or empty.

3020

The parameter cardholder.name can not be null or empty.

3021

The parameter cardholder.document.number can not be null or empty.

3022

The parameter cardholder.document.type can not be null or empty.

3023

The parameter cardholder.document.subtype can not be null or empty.

3024

Not valid action - partial refund unsupported for this transaction.

3025

Invalid Auth Code.

3026

Invalid card_id for this payment_method_id.

3027

Invalid payment_type_id.

3028

Invalid payment_method_id.

3029

Invalid card expiration month.

3030

Invalid card expiration year.

3031

Secure_code_id can't be null.

3032

Invalid security_code_length 3033 3034 - Invalid card_number_validation.

4000

card atributte can't be null.

4001

payment_method_id atributte can't be null.

4002

transaction_amount atributte can't be null.

4003

transaction_amount atributte must be numeric.

4004

installments atributte can't be null.

4005

installments atributte must be numeric.

4006

payer atributte is malformed.

4007

site_id atributte can't be null.

4012

payer.id atributte can't be null.

4013

payer.type atributte can't be null.

4015

payment_method_reference_id atributte can't be null.

4016

payment_method_reference_id atributte must be numeric.

4017

status atributte can't be null.

4018

payment_id atributte can't be null.

4019

payment_id atributte must be numeric.

4020

notificaction_url atributte must be url valid.

4021

notificaction_url atributte must be shorter than 500 characters.

4022

metadata atributte must be a valid JSON.

4023

transaction_amount atributte can't be null.

4024

transaction_amount atributte must be numeric.

4025

refund_id can't be null.

4026

Invalid coupon_amount.

4027

campaign_id atributte must be numeric.

4028

coupon_amount atributte must be numeric.

4029

Invalid payer type.

4037

Invalid transaction_amount.

4038

application_fee cannot be bigger than transaction_amount.

4039

application_fee cannot be a negative value.

4050

payer.email must be a valid email.

4051

payer.email must be shorter than 254 characters.

6033

User unavailable.

7523

Invalid expiration date.

403Erro

4

The caller is not authorized to access this resource.

3002

The caller is not authorized to perform this action.

404Erro

2000

Payment not found. This error will return a field called "data". This field contains the error date "25-09-2023T16:57:53UTC" and a Request ID, an ID that identifies payment traceability.

Requisição
curl -X POST \
    'https://api.mercadopago.com/v1/payments'\
    -H 'Content-Type: application/json' \
       -H 'X-Idempotency-Key: 0d5020ed-1af6-469c-ae06-c3bec19954bb' \
       -H 'Authorization: Bearer TEST-2151*********762-03031*********750b665b7*********4dac477-1*********' \
    -d '{
  "additional_info": {
    "items": [
      {
        "id": "MLB2907679857",
        "title": "Point Mini",
        "description": "Point product for card payments via 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": 58.8,
        "type": "electronics",
        "event_date": "2023-12-31T09:37:52.000-04:00",
        "warranty": false,
        "category_descriptor": {
          "passenger": {},
          "route": {}
        }
      }
    ],
    "payer": {
      "first_name": "Test",
      "last_name": "Test",
      "phone": {
        "area_code": 11,
        "number": "987654321"
      },
      "address": {
        "street_number": null
      }
    },
    "shipments": {
      "receiver_address": {
        "zip_code": "12312-123",
        "state_name": "Rio de Janeiro",
        "city_name": "Buzios",
        "street_name": "Av das Nacoes Unidas",
        "street_number": 3003
      },
      "width": null,
      "height": null
    }
  },
  "application_fee": null,
  "binary_mode": false,
  "campaign_id": null,
  "capture": false,
  "coupon_amount": null,
  "description": "Payment for product",
  "differential_pricing_id": null,
  "external_reference": "MP0001",
  "installments": 1,
  "metadata": {},
  "payer": {
    "entity_type": "individual",
    "type": "customer",
    "id": null,
    "email": "test_user_123@testuser.com",
    "identification": {
      "type": "CPF",
      "number": "95749019047"
    }
  },
  "payment_method_id": "master",
  "token": "ff8080814c11e237014c1ff593b57b4d",
  "transaction_amount": 58.8
}'
Resposta de exemplo
{
  "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",
  "money_release_date": "2019-07-24T14:47:58.000Z",
  "issuer_id": 25,
  "payment_method_id": "visa",
  "payment_type_id": "credit_card",
  "status": "approved",
  "status_detail": "accredited",
  "currency_id": "BRL",
  "description": "Point Mini a maquininha que dá o dinheiro de suas vendas na hora.",
  "taxes_amount": 0,
  "shipping_amount": 0,
  "collector_id": 448876418,
  "payer": {
    "id": 123,
    "email": "test_user_80507629@testuser.com",
    "identification": {
      "number": 19119119100,
      "type": "CPF"
    },
    "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": 58.8
      }
    ],
    "payer": {
      "registration_date": "2019-01-01T15:01:01.000Z"
    },
    "shipments": {
      "receiver_address": {
        "street_name": "Av das Nacoes Unidas",
        "street_number": 3003,
        "zip_code": 6233200,
        "city_name": "Buzios",
        "state_name": "Rio de Janeiro"
      }
    }
  },
  "external_reference": "MP0001",
  "transaction_amount": 58.8,
  "transaction_amount_refunded": 0,
  "coupon_amount": 0,
  "transaction_details": {
    "net_received_amount": 56.16,
    "total_paid_amount": 58.8,
    "overpaid_amount": 0,
    "installment_amount": 58.8
  },
  "fee_details": [
    {
      "type": "coupon_fee",
      "amount": 2.64,
      "fee_payer": "payer"
    }
  ],
  "statement_descriptor": "MercadoPago",
  "installments": 1,
  "card": {
    "first_six_digits": 423564,
    "last_four_digits": 5682,
    "expiration_month": 6,
    "expiration_year": 2023,
    "date_created": "2019-07-10T14:47:58.000Z",
    "date_last_updated": "2019-07-10T14:47:58.000Z",
    "cardholder": {
      "name": "APRO",
      "identification": {
        "number": 19119119100,
        "type": "CPF"
      }
    }
  },
  "notification_url": "https://www.suaurl.com/notificacoes/",
  "processing_mode": "aggregator",
  "point_of_interaction": {
    "type": "PIX",
    "application_data": {
      "name": "NAME_SDK",
      "version": "VERSION_NUMBER"
    },
    "transaction_data": {
      "qr_code_base64": "iVBORw0KGgoAAAANSUhEUgAABRQAAAUUCAYAAACu5p7oAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAIABJREFUeJzs2luO3LiWQNFmI+Y/Zd6vRt36KGNXi7ZOBtcagHD4kNLeiLX33v8DAAAAABD879sDAAAAAAA/h6AIAAAAAGSCIgAAAACQCYoAAAAAQCYoAgAAAACZoAgAAAAAZIIiAAAAAJAJigAAAABAJigCAAAAAJmgCAAAAABkgiIAAAAAkAmKAAAAAEAmKAIAAAAAmaAIAAAAAGSCIgAAAACQCYoAAAAAQCYoAgAAAACZoAgAAAAAZIIiAAAAAJAJigAAAABAJigCA...",
      "qr_code": "00020126600014br.gov.bcb.pix0117test@testuser.com0217dados adicionais520400005303986540510.005802BR5913Maria Silva6008Brasilia62070503***6304E2CA",
      "ticket_url": "https://www.mercadopago.com.br/payments/123456789/ticket?caller_id=123456&hash=123e4567-e89b-12d3-a456-426655440000"
    }
  }
}