Discounted Basket Transfer
A discounted basket works with the same flow as the other App2App baskets. The partner triggers the https://basket.ode.al/{referenceCode} address, and Ödeal retrieves the basket details from the partner's basketUrl address via a GET request. The difference is that allowances (discount) information is added to the products in the basket details, and the totalAllowance and paidAmount fields are added to the basket summary.
POINTS TO CONSIDER IN THE CALCULATION
1. All amounts are sent VAT inclusive.
| Field | Meaning |
|---|---|
products[].price.grossPrice | Undiscounted, VAT-inclusive unit price of the product |
products[].allowances[].price | VAT-inclusive discount amount applied to the whole line (quantity × unit price). It is not per unit. |
basketPrice.grossPrice | Undiscounted, VAT-inclusive basket total |
basketPrice.totalAllowance | Sum of the discount amounts sent on the products (VAT inclusive) |
basketPrice.paidAmount | Amount to be collected: grossPrice − totalAllowance |
2. totalAllowance must always be sent. Even if the products contain allowances, if totalAllowance is not sent or is sent as 0, the discounts are ignored and the basket is created with the undiscounted amount.
3. totalAllowance must exactly match the sum of the product discounts, to the kuruş. Otherwise the 2081 - Discount amount is wrong error is returned.
4. Distribute the subtotal discount to the products over the VAT-inclusive amount. For example, if a 40.00 TL discount is applied to the subtotal, distribute this amount in proportion to the VAT-inclusive line amounts, round each line to 2 decimals and add the remaining kuruş to the last line. The discounts on the lines must add up to exactly 40.00.
Do not split the VAT-exclusive (tax base) amount across the lines and then add VAT to each line and round it. The rounding on each line may push the total 1 kuruş up or down.
5. A 1 kuruş difference is normal. On discounted lines, Ödeal rounds the tax base and VAT to 2 decimals per line; the basket and invoice totals are made up of the line totals (GİB document arithmetic). Therefore a difference of at most 1 kuruş may occur between your grossPrice − totalAllowance calculation and the total calculated by Ödeal, and this difference is accepted. If the difference exceeds 1 kuruş, the basket is rejected.
6. It is normal for the receipt and the invoice to show different discount figures. The information receipt shows the VAT-inclusive discount total (totalAllowance), while the invoice shows the VAT-exclusive discount amount (deducted from the tax base).
Fields
The discount is sent with the allowances array under products[]:
| Field | Type | Description |
|---|---|---|
price | decimal | For an amount-based discount, the VAT-inclusive discount amount applied to the whole line |
rate | decimal | For a rate-based discount, the percentage value (e.g. 10 = 10%) |
isRateBased | boolean | Required. false for an amount-based discount, true for a rate-based discount |
subType | string | LINE: line (product) discount, SUB: the line's share of the subtotal discount |
ORDER OF APPLICATION
If a product has more than one discount, LINE discounts are applied first, followed by SUB discounts. To keep the calculation predictable, we recommend sending a single discount per product.
RESTRICTIONS
- The basket total after the discount cannot be less than 1 TL.
- No discount is applied to current account and advance information receipts, since no products are sent in them.
Example Scenario
The basket contains three products and a VAT-inclusive 40.00 TL discount will be applied to the subtotal:
| Product | Qty | VAT-incl. unit | VAT | Line amount | Share | Line discount |
|---|---|---|---|---|---|---|
| Gözleme | 2 | 120.00 | 10% | 240.00 | 240 / 405 | 23.70 |
| Ayran | 3 | 35.00 | 10% | 105.00 | 105 / 405 | 10.37 |
| Cola | 1 | 60.00 | 20% | 60.00 | 60 / 405 | 5.93 |
| Total | 405.00 | 40.00 |
After rounding the line discounts to 2 decimals, their total is exactly 40.00, so no kuruş adjustment was needed. Had the total differed from 40.00, the difference would have been added to the last line.
Basket Detail Format
The basket detail you return for the relevant referenceCode must be in the following format:
{
"referenceCode": "ISK-20261023-0001",
"receiptInfo": {
"Masa No": "12",
"Adisyon No": "4587"
},
"employeeInfo": {
"employeeReferenceCode": "100",
"name": "Mehmet",
"surname": "Demir",
"identityNumber": "10000000146",
"gsmNumber": "5321234567",
"mailAddress": null
},
"customerInfo": {
"type": "INDIVIDUAL",
"title": null,
"name": "Ayşe",
"surname": "Yılmaz",
"identityNumber": "10000000146",
"taxNumber": null,
"taxOffice": null,
"gsmNumber": "5321234567",
"email": "[email protected]",
"city": "İstanbul",
"town": "Kadıköy",
"address": "Caferağa Mah. Örnek Sok. No:1",
"referenceCode": "CUST-0001"
},
"products": [
{
"referenceCode": "GZL-01",
"name": "Gözleme",
"quantity": 2,
"unitCode": "C62",
"price": { "grossPrice": 120.00, "vatRatio": 10, "sctRatio": 0 },
"allowances": [
{ "price": 23.70, "isRateBased": false, "subType": "SUB" }
]
},
{
"referenceCode": "AYR-01",
"name": "Ayran",
"quantity": 3,
"unitCode": "C62",
"price": { "grossPrice": 35.00, "vatRatio": 10, "sctRatio": 0 },
"allowances": [
{ "price": 10.37, "isRateBased": false, "subType": "SUB" }
]
},
{
"referenceCode": "KLA-01",
"name": "Cola",
"quantity": 1,
"unitCode": "C62",
"price": { "grossPrice": 60.00, "vatRatio": 20, "sctRatio": 0 },
"allowances": [
{ "price": 5.93, "isRateBased": false, "subType": "SUB" }
]
}
],
"basketPrice": {
"grossPrice": 405.00,
"totalAllowance": 40.00,
"paidAmount": 365.00
},
"paymentOptions": [
{
"type": "CASH",
"amount": 365.00
}
]
}Important
You must return a response in the format above using the referenceCode parameter that arrives at your basketUrl address during the request. The paymentOptions amount must be the amount to be collected after the discount (paidAmount).
Result Calculated by Ödeal
| Product | Line amount | Discount (VAT incl.) | Tax base | VAT | Payable |
|---|---|---|---|---|---|
| Gözleme | 240.00 | 23.70 | 196.64 | 19.66 | 216.30 |
| Ayran | 105.00 | 10.37 | 86.03 | 8.60 | 94.63 |
| Cola | 60.00 | 5.93 | 45.06 | 9.01 | 54.07 |
| Total | 405.00 | 40.00 | 327.73 | 37.27 | 365.00 |
Why Does a 1 Kuruş Difference Occur?
In the example below, three products with a VAT-inclusive unit price of 30.204 TL (25.17 TL excluding VAT, 20% VAT) are sold, two of each. The subtotal is 181.22 TL and a VAT-exclusive 10.00 TL (12.00 TL VAT inclusive) discount is to be applied to the subtotal.
| Line discounts sent | totalAllowance | Discount on invoice (VAT excl.) | Grand total |
|---|---|---|---|
| 4.00 / 4.00 / 4.00 | 12.00 | 3.33 + 3.33 + 3.33 = 9.99 | 169.23 |
| 4.00 / 4.00 / 4.01 | 12.01 | 3.33 + 3.33 + 3.34 = 10.00 | 169.22 |
In the first row, when 12.00 TL is split equally across three lines, each line's tax base discount of 3.333 is rounded to 3.33; the invoice shows a 9.99 discount and a 169.23 total. In the second row, the kuruş difference is given to the last line, so the invoice discount is exactly 10.00 and the grand total is 169.22.
RECOMMENDATION
If you want the discount amount on the invoice to exactly match your target value, distribute the target amount to the lines with 2 decimals and give the kuruş difference to a single line. Calculate each line's VAT-inclusive equivalent from this amount, round it and send it. In this case the VAT-inclusive discount total shown on the receipt (12.01 in the example above) may differ at the kuruş level; this is not an error.

