Stock Lock
Reservasi stok sementara selama periode pembayaran untuk mencegah overselling. Lock stok sebelum buyer bayar agar tidak diambil oleh pembeli lain.
Alur Penggunaan
Buyer pilih
produk
Lock stok
(10 menit)
Buyer
bayar
Buat trx
+ lock_token
Penting
- Lock berlaku maksimal 10 menit. Setelah expired, stok otomatis kembali tersedia.
- Maksimal 50 lock aktif secara bersamaan per akun reseller.
- Lock tidak diperlukan untuk produk dengan stok unlimited (manual/h2h).
- Saat membuat transaksi dengan
lock_token, stok dijamin tersedia.
/v1/item/lock
Lock Stock
Reservasi stok untuk item tertentu selama periode pembayaran.
Request Body
| Parameter | Type | Description |
|---|---|---|
item_id
Required
|
integer | ID item/variant yang akan di-lock. |
quantity
Required
|
integer |
Jumlah stok yang akan di-lock. Minimal sesuai min_order item.
|
lock_duration
|
integer | Optional. Durasi lock dalam detik. Min: 60, Max: 600 (10 menit). Default: 600. |
Error Responses
Item tidak ditemukan atau tidak aktif.
Stok tidak mencukupi untuk di-lock.
Quantity kurang dari minimum order item.
Item memiliki stok unlimited, tidak perlu di-lock.
Sudah mencapai batas maksimal 10 lock aktif.
/v1/item/lock
List Active Locks
Lihat semua lock aktif milik Anda beserta sisa waktu.
/v1/item/lock/{lock_token}
Release Lock
Batalkan lock secara manual. Stok akan langsung tersedia kembali.
Error Responses
Lock token tidak ditemukan atau bukan milik Anda.
Lock sudah tidak aktif.
/v1/trx
+ lock_token
Create Transaction with Lock
Saat membuat transaksi via POST /v1/trx,
tambahkan parameter lock_token
untuk menjamin stok yang sudah di-lock.
| Parameter | Type | Description |
|---|---|---|
lock_token
|
string |
Optional. Token dari POST /v1/item/lock.
Item dan quantity di carts harus match dengan lock.
|
Lock-specific Errors
Lock token tidak ditemukan.
Lock sudah expired, stok tidak lagi di-reservasi.
item_id / quantity di carts tidak sesuai dengan lock.
1. Lock Stock
curl --request POST \ --url https://sekalipay.com/api/v1/item/lock \ --header 'X-APIKEY: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "item_id": 123, "quantity": 1, "lock_duration": 600 }'
Lock Response
{
"success": true,
"data": {
"lock_token": "LCK-a1b2c3d4-...",
"item_id": 123,
"quantity": 1,
"locked_at": "2026-02-27T20:00:00Z",
"expires_at": "2026-02-27T20:10:00Z"
}
}
2. Create Transaction + Lock
curl --request POST \ --url https://sekalipay.com/api/v1/trx \ --header 'X-APIKEY: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "ref_id": "INV-20260227-ABC", "lock_token": "LCK-a1b2c3d4-...", "carts": [ { "item_id": 123, "quantity": 1 } ] }'
3. Release Lock (Cancel)
curl --request DELETE \ --url https://sekalipay.com/api/v1/item/lock/LCK-a1b2c3d4-... \ --header 'X-APIKEY: YOUR_API_KEY'
4. List Active Locks
curl --request GET \ --url https://sekalipay.com/api/v1/item/lock \ --header 'X-APIKEY: YOUR_API_KEY'