4. Tax Calculation
Brief Description
- Swifood calculates the tax related information of the product by using the order price, service fee, discount type, discount amount and other information.
Request URL
{domain}/open-api/order/tax/calculate
Request Method
| Parameter Name | Required | Type | Description |
| Content-Type | Yes | string | application/json |
Request Body Parameters
| Parameter Name | Required | Type | Length Limit | Example | Description |
| appId | Yes | string | - | 45eebd745dcf0b5f6d6f9fcde28cd9fe8116a892 | App id (provided by Swifood) |
| storeKey | Yes | string | 100 | CVIEIYUNHTS0 | Store key (provided by Swifood) |
| param | Yes | string | - | - | Request param content string |
| sign | Yes | string | - | | RSA sign of param |
Param Parameters
| Parameter Name | Required | Type | Length Limit | Example | Description |
| totalAmount | Yes | integer | 0 - 100000000 | 1000 | Total order price after tax, Unit: cents |
| serviceFee | No | integer | 0 - 10000000 | 100 | Service charge |
| discountType | No | integer | - | 1 | Discount type 1: PWD discount; 2: Promo discount; 4: SC discount |
| promoDiscountType | No | integer | - | 1 | 1. Whole order discount 2. Product discount |
| discountAmount | No | integer | - | 10 | Promo discount amount (For promo discount, this parameter is filled) |
| deliveryFee | No | integer | - | 100 | Delivery fee (required for takeout orders) |
| packingFee | No | integer | - | 100 | Packing fee (required for takeout orders |
| productInfo | No | List | 1 - 210 | - | Product info |
Product Info Param
| Parameter Name | Required | Type | Length Limit | Example | Description |
| productName | Yes | string | 1 - 50 | coffee | Product name |
| price | Yes | integer | 0 - 1000000 | 100 | Unit price of product after tax, Unit: cents |
| quantity | Yes | integer | 1 - 1000 | 1 | Product quantity |
| discountAmount | No | integer | 1 - 1000000 | | Product promo discount amount (This value is required when it is a Promo discount) |
Request body example
Response Example
Response Parameters
| Parameter Name | Type | Example | Description |
| code | int | 10000 | Status Code Refer to List |
| message | string | success | Status Code Information |
| data | string | - | Response Param |
| productAmount | integer | 100 | Order price before tax |
| taxAmount | integer | - | Order Tax amount |
| vatableSales | integer | - | The total amount of product subject to tax before tax, excluding service fee |
| vatExemptSales | integer | - | Pre-tax sales amount of duty-free product (PWD/SC discount product) |
| vatExemption | integer | - | The amount of tax exempt |
| zeroRatedSales | integer | - | Duty-free product amount |
| discountedAmount | integer | 80 | Amount after order discount |
| productTaxInfo | List | - | product tax info |
Product Tax Info Param
| Parameter Name | Type | Length Limit | Description |
| productName | string | 1 - 50 | Product name |
| productAmount | integer | 1 - 1000000 | Product price before tax |
| taxAmount | integer | - | Product tax amount |
| vatableSales | integer | - | The total amount of product subject to tax before tax, excluding service fee |
| vatExemptSales | integer | - | Pre-tax sales amount of duty-free product (PWD/SC discount product) |
| vatExemption | integer | - | The amount of tax exempt |
| zeroRatedSales | integer | - | Duty-free product amount |
Failed Response Example