Create discount promisehttps://api.mercadopago.com/v2/wallet_connect/discounts
This endpoint allows you to create a "discount promise" for Wallet Connect. This "discount promise" serves as a reference that can be used when generating an Advanced Payment, enabling the application of a specific discount to the payment. During the payment creation process, it's essential to include the information from the previously provided "discount promise".
POST
Request parameters
Header
Authorization
Access Token obtained through the developer panel. Must be sent in all requests.string
REQUIRED
x-payer-token
Token associated to the potential payer who will use the discount. For example - e9449535fe074e0e8ff4f2055f604e51.string
REQUIRED
Body
coupon
UUnique ID that identifies the coupon for discount application. This field should be filled out only when the user enters a coupon during the purchasing process with the seller.string
amount
Total payment amount before aplying discount. For example, 15.05.number
REQUIRED
Response parameters
transaction_amount
Total payment amount before aplying discount. For example, 150.number
currency_id
Type of currency to be used in payment. For example, ARS for Argentina, BRL for Brazil. This field varies according to your location.string
legal_terms
Terms and conditions of discount.string
discount
Discount description.object
Errors
400Error
400
Bad-Request - Invalid amount in discount.
400
Bad-Request - Invalid coupon in discount.
400
Bad-Request - Invalid payer token.
500Error
500
Error - Internal server error.
Request
curl -X POST \
'https://api.mercadopago.com/v2/wallet_connect/discounts'\
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer APP_USR-8*********932064-12*********edf6d3c99*********2236c703f*********668' \
-H 'x-payer-token: <PAYER_TOKEN>' \
-d '{
"coupon": "WALLET10",
"amount": 15.05
}'Response
{
"transaction_amount": 150,
"currency_id": "ARS",
"legal_terms": "https://api.mercadopago.com/v2/discounts/campaign/10580513/terms/html",
"discount": {
"amount": 15,
"detail": {
"cap": 1000000,
"type": "percentage",
"value": 10
}
}
}