Documentation
Feedback
Guides
API Reference

Guides
CheckoutDiscounts
Set a discount using the Checkout API

One of the most used customer attraction strategies in ecommerce is applying a discount to the cash price when choosing a specific payment method. Commonly, the discount price is visible only at the checkout payment stage after the user has already chosen the payment method that grants the discount.

This Checkout configuration sets the discount price and links it to a payment method. To configure, follow the steps below:

  1. Use the Update orderForm configuration endpoint to enter the desired payment method ID in the paymentSystemToCheckFirstInstallment property.

  2. To get the payment method ID, access Settings in the Payments module. The ID of the condition you want to use is on the right side of the screen in the Payments Settings > Payments Conditions section.

{"base64":"  ","img":{"width":1423,"height":364,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":32447,"url":"https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/set-a-discount-using-the-checkout-api-0.png"}}

  1. After updating paymentSystemToCheckFirstInstallment, you can Simulate a shopping cart. Thus, you will be able to verify that the chosen payment method has been updated with the discount in the cash payment option in the installmentOptions section, within paymentData.

_19
"paymentData":{
_19
"installmentOptions":[
_19
{
_19
"paymentSystem":"6",
_19
"paymentName":"Boleto Bancário",
_19
"paymentGroupName":"bankInvoicePaymentGroup",
_19
"value":10000,
_19
"installments":[
_19
{
_19
"count":1,
_19
"hasInterestRate":false,
_19
"interestRate":0,
_19
"value":9000,
_19
"total":9000,
_19
}
_19
]
_19
}
_19
]
_19
}

For more information, check Configuring a discount for orders prepaid in full.

Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page