Crear pago/v1/paymentsRealiza la creación de un pago y agrega toda la información que necesites. Ten en cuenta de sumar el detalle del pago y los datos del pagador.
POST
Productos que lo utilizan:
Parámetros para la solicitud
additional_info
Localización: bodyEn el nivel de Pagos, son solo datos y únicamente reenviamos esa información a otras API, como Riesgo, para realizar puntajes y prevenir fraudes, o a Impuestos, para determinarlos para pagos internacionales.object
application_fee
Localización: bodyComisión (fee) que los terceros (integradores) cobran a sus clientes, en este caso vendedores, por utilizar la plataforma del marketplace y otros servicios. Este es un valor en reales que será definido por el integrador para el vendedor.number
binary_mode
Localización: bodyCuando se configura como TRUE los pagos sólo pueden resultar aprobados o rechazados. Caso contrario también pueden resultar in_process.boolean
callback_url
Localización: bodyURL a la cual Mercado Pago hace la redirección final (sólo para transferencia bancaria).string
Parámetros de respuesta
id
Localización: bodyIdentificador único del pago, generado automáticamente por Mercado Pagonumber
date_created
Localización: bodyFecha de creación del Pago.string
date_approved
Localización: bodyFecha de aprobación del Pago. Un pago puede generarse en un estado intermedio y luego ser aprobado, por tanto la fecha de creación no siempre coincidirá con la Fecha de Aprobación.string
date_last_updated
Localización: bodyFecha en la que se registró el ultimo evento sobre el pago.string
Solicitud
curl
curl -X POST \
'https://api.mercadopago.com/v1/payments' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"additional_info": {
"items": [
{
"id": "MLB2907679857",
"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_medium@2x.png",
"category_id": "electronics",
"quantity": 1,
"unit_price": 58.8
}
],
"payer": {
"first_name": "Test",
"last_name": "Test",
"phone": {
"area_code": 11,
"number": "987654321"
},
"address": {}
},
"shipments": {
"receiver_address": {
"zip_code": "12312-123",
"state_name": "Rio de Janeiro",
"city_name": "Buzios",
"street_name": "Av das Nacoes Unidas",
"street_number": 3003
}
}
},
"description": "Payment for product",
"external_reference": "MP0001",
"installments": 1,
"metadata": {},
"payer": {
"entity_type": "individual",
"type": "customer",
"identification": {}
},
"payment_method_id": "visa",
"token": "ff8080814c11e237014c1ff593b57b4d",
"transaction_amount": 58.8
}'
Respuesta
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",
"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_medium@2x.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"
}
}
}
Errores
400bad_request
1
3Token must be for test.
5Must provide your access_token to proceed.
23The following parameters must be valid date and format (yyyy-MM-dd'T'HH:mm:ssz) date_of_expiration.
1000Number of rows exceeded the limits.
1001Date format must be yyyy-MM-dd'T'HH:mm:ss.SSSZ.
2001Already posted the same request in the last minute.
2002Customer not found.
2004POST to Gateway Transactions API fail.
2006Card Token not found.
2007Connection to Card Token API fail.
2009Card token issuer can't be null.
2060The customer can't be equal to the collector.
2077Deferred capture not supported.
3000You must provide your cardholder_name with your card data.
3001You must provide your cardissuer_id with your card data.
3003Invalid card_token_id.
3004Invalid parameter site_id.
3005Not valid action, the resource is in a state that does not allow this operation. For more information see the state that has the resource.
3006Invalid parameter cardtoken_id.
3007The parameter client_id can not be null or empty.
3008Not found Cardtoken.
3009unauthorized client_id.
3010Not found card on whitelist.
3011Not found payment_method.
3012Invalid parameter security_code_length.
3013The parameter security_code is a required field can not be null or empty.
3014Invalid parameter payment_method.
3015Invalid parameter card_number_length.
3016Invalid parameter card_number.
3017The parameter card_number_id can not be null or empty.
3018The parameter expiration_month can not be null or empty.
3019The parameter expiration_year can not be null or empty.
3020The parameter cardholder.name can not be null or empty.
3021The parameter cardholder.document.number can not be null or empty.
3022The parameter cardholder.document.type can not be null or empty.
3023The parameter cardholder.document.subtype can not be null or empty.
3024Not valid action - partial refund unsupported for this transaction.
3025Invalid Auth Code.
3026Invalid card_id for this payment_method_id.
3027Invalid payment_type_id.
3028Invalid payment_method_id.
3029Invalid card expiration month.
3030Invalid card expiration year.
4000card atributte can't be null.
4001payment_method_id atributte can't be null.
4002transaction_amount atributte can't be null.
4003transaction_amount atributte must be numeric.
4004installments atributte can't be null.
4005installments atributte must be numeric.
4006payer atributte is malformed.
4007site_id atributte can't be null.
4012payer.id atributte can't be null.
4013payer.type atributte can't be null.
4015payment_method_reference_id atributte can't be null.
4016payment_method_reference_id atributte must be numeric.
4017status atributte can't be null.
4018payment_id atributte can't be null.
4019payment_id atributte must be numeric.
4020notificaction_url atributte must be url valid.
4021notificaction_url atributte must be shorter than 500 characters.
4022metadata atributte must be a valid JSON.
4023transaction_amount atributte can't be null.
4024transaction_amount atributte must be numeric.
4025refund_id can't be null.
4026Invalid coupon_amount.
4027campaign_id atributte must be numeric.
4028coupon_amount atributte must be numeric.
4029Invalid payer type.
4037Invalid transaction_amount.
4038application_fee cannot be bigger than transaction_amount.
4039application_fee cannot be a negative value.
4050payer.email must be a valid email.
4051payer.email must be shorter than 254 characters.
7523Invalid expiration date.
403bad_request
4The caller is not authorized to access this resource.
3002The caller is not authorized to perform this action.
404bad_request
2000Payment not found