• API Docs
  • Mercado Shops Guide
  • Orders invoicing with coupons
Last update 07/06/2022

Orders invoicing with coupons

Important:
This feature applies only to discounts covered by the seller in the Mercado Shops channel.

Sellers can generate discount coupons in their Mercado Shops channel for direct and/or cart sales. For this, they must cover the total value of the coupon offered and be deducted in the invoice you make to avoid collecting incorrect taxes. In the payment detail you will see the use of the coupon in the transaction. Learn more how to create, edit and delete discount coupon.


Validate approved payment

Before consulting the discounts applied to certain order payments, you should check that the payment detail in the order has “status”:”paid”, and the payment with “status”: “approved”.

When the sale is through a shopping cart, you must remember:

  • The “pack_order” tag is generated automatically to be able to discriminate if the order is associated with a cart and cannot be deleted by the buyer or seller.
  • The "pack_id" field shows the cart number to which the order belongs.

Check discount coupons to invoice

Using the order payment/s, you can check the discount coupons. Check the “fee_details” node to get the discount value, as long as the “fee_payer” field equals ”collector” and the “type” equals “coupon_fee”.

To get the discount total value on the invoice you must add the amounts with “type”:”coupon_fee”.

Note:
If the order is a cart, you must repeat these steps for each payment made.

Order payment example:

curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadopago.com/v1/payments/15733180247

Short response:

[…]
"fee_details": [
       {
           "amount": 13243.78,
           "fee_payer": "collector,
           "type": "coupon_fee"
       },
       {
           "amount": 8301.68,
           "fee_payer": "collector,
           "type": "application_fee"
       }
   ],
   "financing_type": null,
   "id": 15733180247,
   "installments": 1,
   "integrator_id": null,
   "internal_metadata": {
       "rule_engine": {
           "valid_promise": false,
           "with_promise": false,
           "rules": [
               {
                   "rule_id": 21000002955,
                   "rule_set": "processing_fee_and_release"
               }
           ]
       },
[…]