Langsung ke konten utama
POST
/
v3
/
stores
/
{store_id}
/
public
/
discount-codes
/
check
Check discount code validity
curl --request POST \
  --url https://api.scalev.com/v3/stores/{store_id}/public/discount-codes/check \
  --header 'Content-Type: application/json' \
  --header 'X-Scalev-Storefront-Api-Key: <x-scalev-storefront-api-key>' \
  --data '
{
  "code": "SAVE10",
  "items": [
    {
      "type": "variant",
      "variant_id": 2,
      "quantity": 50
    }
  ],
  "courier_service_id": 123,
  "warehouse_unique_id": "<string>",
  "courier_aggregator_code": "<string>",
  "payment_method": "bank_transfer",
  "net_product_price": "<string>",
  "gross_revenue": "<string>",
  "shipping_cost": "<string>"
}
'
{
  "discount_code": {
    "id": 123,
    "business_id": 123,
    "is_enabled": true,
    "code": "<string>",
    "applied_to": "<string>",
    "amount_type": "<string>",
    "percentage": "<string>",
    "is_max_amount": true,
    "max_amount": "<string>",
    "amount": "<string>",
    "is_usage_limit": true,
    "usage_limit": 123,
    "current_usage": 123,
    "is_expiry": true,
    "expiry_time": "2023-11-07T05:31:56Z",
    "is_limited_to_pages": true,
    "pages": [
      {}
    ],
    "is_limited_to_payment_methods": true,
    "payment_methods": [
      "<string>"
    ],
    "is_minimum_revenue": true,
    "minimum_revenue": "<string>",
    "inserted_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  },
  "eligibility_details": {},
  "is_eligible": true,
  "discount_code_discount": "<string>"
}

Header

X-Scalev-Storefront-Api-Key
string
wajib

Publishable storefront public API key for the target store. Page public API keys are not accepted on Storefront public routes.

X-Scalev-Guest-Token
string<uuid>

Browser-safe guest cart token returned by the first guest-cart response when no token is sent. Send it on later guest-cart and public checkout calls to keep the same cart after reloads.

Parameter Path

store_id
string
wajib

Store unique_id.

Body

application/json
code
string
wajib

Discount code to validate.

Contoh:

"SAVE10"

items
object[]

Optional direct item source. If supplied, these items are used for discount eligibility. Otherwise the guest cart referenced by X-Scalev-Guest-Token is used.

Required array length: 1 - 50 elements
destination
object
courier_service_id
warehouse_unique_id
string
courier_aggregator_code
string | null
payment_method
string

Storefront payment method code selected by the buyer.

Contoh:

"bank_transfer"

net_product_price
gross_revenue
shipping_cost

Respons

Discount code validation result

discount_code
object
wajib
eligibility_details
object
wajib
is_eligible
boolean
wajib
discount_code_discount
wajib