Endpoint untuk menghitung checkout dan mengambil quote pembayaran.
Checkout API digunakan untuk menghitung nilai checkout sebelum order dibuat.
Endpoint
POST /checkout/calculate
GET /checkout/quote
Scopes
| Endpoint | Scope |
|---|
/checkout/calculate | checkout:read |
/checkout/quote | checkout:read |
Pada beberapa kondisi, endpoint quote juga dapat berkaitan dengan scope coupons:read jika menggunakan kupon.
Calculate Checkout
POST /wp-json/sejoli/v1/checkout/calculate
Parameter yang ditemukan:
| Parameter | Tipe | Wajib | Keterangan |
|---|
product_id | integer | Ya | ID produk. |
coupon | string | Tidak | Kode kupon. |
quantity | integer | Tidak | Jumlah pembelian. Default 1. |
Contoh:
curl -X POST \
-H "Authorization: Bearer sejoliapi_xxxxxxxx_secret" \
-H "Content-Type: application/json" \
-d '{"product_id":123,"quantity":1,"coupon":"PROMO10"}' \
"https://domain-anda.com/wp-json/sejoli/v1/checkout/calculate"
Checkout Quote
GET /wp-json/sejoli/v1/checkout/quote
Gunakan endpoint ini untuk mendapatkan estimasi checkout berdasarkan parameter yang didukung oleh controller.