AI resources
Create discount promisehttps://api.mercadopago.com/v2/wallet_connect/discounts
This endpoint creates a discount promise for Wallet Connect. A discount promise is a reference that can be used when creating an advanced payment to apply a specific discount. The information from the discount promise must be included during the payment creation. In case of success, the request will return a response with status 200.
POST
Request parameters
Header
Authorization
Access Token obtained through the developer panel. Must be sent in all requests.string
REQUIRED
x-payer-token
Payer token associated with the buyer who will use the discount.string
REQUIRED
Body
coupon
Unique coupon code for the discount. Send only when the buyer entered a coupon during the purchase flow.string
amount
Total payment amount before applying the discount.number
REQUIRED
Response parameters
transaction_amount
Total payment amount before applying the discount.number
currency_id
Currency used in the payment.string
legal_terms
URL with the terms and conditions of the discount.string
discount
Discount details.object
Errors
400Request error.
400
Bad Request — Invalid amount.
400
Bad Request — Invalid coupon.
400
Bad Request — Invalid payer token.
500Processing error.
internal_error
Some error occurred on our side while attempting to process the request. Please try again later.
Request
curl -X POST \
'https://api.mercadopago.com/v2/wallet_connect/discounts'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-4*********782856-12*********f202ca494*********f0baa4bb3*********648' \
-H 'x-payer-token: <PAYER_TOKEN>' \
-d '{
"coupon": "WALLET10",
"amount": 50
}'Response
{
"transaction_amount": "24.50",
"currency_id": "COP",
"legal_terms": "https://api.mercadopago.com/v2/discounts/campaign/10580513/terms/html",
"discount": {
"amount": "24.50",
"detail": {
"cap": 1000000,
"type": "percentage",
"value": 10
}
}
}