- Home
- API reference
- Payment links
- Cancel a payment link
Cancel a payment link
Stops the link from accepting new payments. Payments already made remain unchanged.
/v1/payment-links/{id}/cancelpayments:write permission.Headers
Section titled “Headers”Idempotency-KeystringrequiredExample: order-1001-attempt-1
Required. A unique string for this request. See Idempotency.
Path parameters
Section titled “Path parameters”idstringrequiredThe id of the payment link (lnk_…).
Example: lnk_01k7q3m8x2v5t9n4b6c1d0e7fa
Prefixed with lnk_.
Response (200)
Section titled “Response (200)”dataobjectrequiredThe returned object, or an array of objects for a list.
idstringrequiredThe id of the payment link (lnk_…).
Example: lnk_01k7q3m8x2v5t9n4b6c1d0e7fa
Prefixed with lnk_.
livemodebooleanrequiredtrue means this object belongs to live and can involve real payments; false means it belongs to the sandbox.
project_idstringrequiredThe project this object belongs to. Its settings determine which payment methods and limits apply.
Example: prj_01k7q3m8x2v5t9n4b6c1d0e7fa
Prefixed with prj_.
urlstringrequiredThe checkout address for this link. Share it with the payer so they can choose a method and pay.
Example: https://pay.baiyar.com/p/lt_live_…
titlestringrequiredThe name shown to the payer, such as a product name or invoice number.
Example: Paket Kopi Senja
descriptionstring | nullrequiredA longer note on the payment page; optional.
Example: Dua bungkus biji kopi 250 gram.
referencestringrequiredYour own reference for the link. Made for you when left out.
Example: INV-2041
statestringrequiredpayable, in_use (a payment is under way), completed, cancelled or expired.
Example: payable
Possible values: payable, in_use, completed, cancelled, expired
amount_modestringrequiredfixed (you set the amount) or open (the payer enters it between the minimum and the maximum).
Example: fixed
Possible values: fixed, open
amountinteger | nullrequiredBase amount of each payment before fees, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 2500000
min_amountinteger | nullrequiredThe minimum amount a payer can enter for an open-amount link, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 1000000
max_amountinteger | nullrequiredThe maximum amount a payer can enter for an open-amount link, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 100000000
currencystringrequiredThe currency, an ISO 4217 code. Only IDR today.
Example: IDR
Value: IDR
usagestringrequiredsingle_use accepts one payment; reusable accepts multiple payments. Defaults to single_use.
Example: single_use
Possible values: single_use, reusable
max_usesinteger | nullrequiredMaximum number of payments in progress or paid before the link stops accepting new payments. Null means there is no limit.
Example: 1
fee_bearerstringrequiredWho bears Baiyar's fee: merchant takes it out of what you receive, customer adds it to what the payer pays.
Example: merchant
Possible values: merchant, customer
customer_fieldsobjectrequiredControls which details checkout asks the payer for. Unspecified fields default to off.
namestringrequiredWhether checkout asks for the payer's name: off, optional (the payer can skip it) or required.
Example: required
Possible values: off, optional, required
emailstringrequiredWhether checkout asks for the payer's email: off, optional (the payer can skip it) or required.
Example: required
Possible values: off, optional, required
phonestringrequiredWhether checkout asks for the payer's phone number: off, optional (the payer can skip it) or required.
Example: off
Possible values: off, optional, required
addressstringrequiredWhether checkout asks for the payer's address: off, optional (the payer can skip it) or required.
Example: off
Possible values: off, optional, required
expires_atstring | nullrequiredWhen the link stops taking payments; null for no end.
Example: 2026-10-26T03:04:05.000Z
Format: date-time
redirect_urlstring | nullrequiredWhere the payer goes after paying, when after_payment is redirect. Must be HTTPS.
Example: https://toko.example.com/terima-kasih
after_paymentstringrequiredconfirmation shows Baiyar's confirmation page; redirect sends the payer to redirect_url. Defaults to confirmation.
Example: confirmation
Possible values: confirmation, redirect
confirmation_messagestring | nullrequiredYour own words on the confirmation page; optional.
Example: Terima kasih! Pesananmu dikirim dalam 2 hari.
methodsarray of objectrequiredThe methods of the link with the fee rule locked when it was made.
payment_methodstringrequiredPayment method offered by this link, for example QRIS or BCA virtual account.
Example: payment.qris
feeobjectrequiredThe fee rule locked into the link; a price change later does not touch it.
flat_amountinteger | nullrequiredThe fixed part of the fee, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 25000
percentnumber | nullrequiredPercentage added to the flat fee; 0.7 means 0.7%. Null means there is no percentage part.
Example: 0.7
tiersarray of objectrequiredFee rules by amount. A tier applies only when the payment amount is strictly above its above_amount threshold.
above_amountintegerrequiredThe step applies to amounts above this, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 10000000
flat_amountinteger | nullrequiredThe fixed part of the fee in this step, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 0
percentnumber | nullrequiredPercentage added to this tier's flat fee; 0.7 means 0.7%.
Example: 0.7
settlement_daysinteger | nullrequiredDays after payment until the money is available.
Example: 1
previewobject | nullrequiredWhat the method would cost at the link's amount; null for a link where the payer enters the amount.
amountintegerrequiredBase amount used for this method's fee estimate, before fees, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 2500000
fee_amountintegerrequiredEstimated Baiyar fee for this method and amount, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 42500
charged_amountintegerrequiredTotal the payer is expected to pay, including the fee when the payer bears it, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 2500000
net_amountintegerrequiredEstimated amount credited to your balance after the Baiyar fee, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 2457500
statsobjectrequiredPayment counts and net amount recorded for this link.
paid_countintegerrequiredNumber of payments made through this link that reached paid status.
Example: 1
open_countintegerrequiredNumber of payments made through this link that are still waiting for the payer.
Example: 0
paid_net_amountintegerrequiredWhat the paid ones net, in the smallest unit of currency (Rp125.000 is 12500000).
Example: 2457500
cancelled_atstring | nullrequiredWhen it was cancelled; null otherwise.
Example: 2026-10-26T03:04:05.000Z
Format: date-time
created_atstringrequiredWhen this object was created (RFC 3339, UTC). Use it to sort objects by creation time.
Example: 2026-10-26T03:04:05.000Z
Format: date-time
metaobjectrequiredRequest details such as its id and pagination cursor.
request_idstringrequiredThe id of this request. Quote it when you ask support about it.
Example: req_Hy3k9QzT2LmN8vXa
A failed request answers with the common error shape; see Errors.
curl -X POST "https://api.baiyar.com/v1/payment-links/{id}/cancel" \ -H "Authorization: Bearer $BAIYAR_KEY" \ -H "Idempotency-Key: order-1001-attempt-1"{ "data": { "id": "lnk_01k7q3m8x2v5t9n4b6c1d0e7fa", "livemode": false, "project_id": "prj_01k7q3m8x2v5t9n4b6c1d0e7fa", "url": "https://pay.baiyar.com/p/lt_live_…", "title": "Paket Kopi Senja", "description": "Dua bungkus biji kopi 250 gram.", "reference": "INV-2041", "state": "payable", "amount_mode": "fixed", "amount": 2500000, "min_amount": 1000000, "max_amount": 100000000, "currency": "IDR", "usage": "single_use", "max_uses": 1, "fee_bearer": "merchant", "customer_fields": { "name": "required", "email": "required", "phone": "off", "address": "off" }, "expires_at": "2026-10-26T03:04:05.000Z", "redirect_url": "https://toko.example.com/terima-kasih", "after_payment": "confirmation", "confirmation_message": "Terima kasih! Pesananmu dikirim dalam 2 hari.", "methods": [ { "payment_method": "payment.qris", "fee": { "flat_amount": 25000, "percent": 0.7, "tiers": [ { "above_amount": 10000000, "flat_amount": 0, "percent": 0.7 } ] }, "settlement_days": 1, "preview": { "amount": 2500000, "fee_amount": 42500, "charged_amount": 2500000, "net_amount": 2457500 } } ], "stats": { "paid_count": 1, "open_count": 0, "paid_net_amount": 2457500 }, "cancelled_at": "2026-10-26T03:04:05.000Z", "created_at": "2026-10-26T03:04:05.000Z" }, "meta": { "request_id": "req_Hy3k9QzT2LmN8vXa" }}