- Home
- API reference
- Payment methods
- Preview fees
Preview fees
Calculates the fee, payer charge and merchant net for up to three amounts. It does not create a payment.
/v1/fee-previewRequest body
Section titled “Request body”project_idstringrequiredThe project to price for. Needed with a merchant key.
Example: prj_01k7q3m8x2v5t9n4b6c1d0e7fa
Prefixed with prj_.
payment_methodsarray of stringoptionalThe methods to price. The project's own methods when left out.
Max items: 40
amountsarray of integerrequiredUp to three amounts to price, each in the smallest unit.
Max items: 3
fee_bearerstringoptionalWho pays the Baiyar fee. Defaults to the project's setting.
Example: customer
Possible values: merchant, customer
Response (200)
Section titled “Response (200)”dataobjectrequiredThe returned object, or an array of objects for a list.
methodsarray of objectrequiredOne result for each method included in the preview.
payment_methodstringrequiredPayment method these fee calculations apply to.
Example: payment.qris
previewsarray of objectrequiredFee calculation for each amount you sent, in the same order. A null entry means the method cannot accept that amount; this preview does not create a payment.
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/fee-preview" \ -H "Authorization: Bearer $BAIYAR_KEY" \ -H "Content-Type: application/json" \ -d '{ "project_id": "prj_01k7q3m8x2v5t9n4b6c1d0e7fa", "amounts": [ 10000000, 50000000 ] }'{ "data": { "methods": [ { "payment_method": "payment.qris", "previews": [ { "amount": 10000000, "fee_amount": 70000, "charged_amount": 10070000, "net_amount": 10000000 } ] } ] }, "meta": { "request_id": "req_Hy3k9QzT2LmN8vXa" }}