Skip to content

Preview fees

Calculates the fee, payer charge and merchant net for up to three amounts. It does not create a payment.


POST/v1/fee-preview
Any API key can call this.
project_idstringrequired

The project to price for. Needed with a merchant key.

Example: prj_01k7q3m8x2v5t9n4b6c1d0e7fa

Prefixed with prj_.

payment_methodsarray of stringoptional

The methods to price. The project's own methods when left out.

Max items: 40

amountsarray of integerrequired

Up to three amounts to price, each in the smallest unit.

Max items: 3

fee_bearerstringoptional

Who pays the Baiyar fee. Defaults to the project's setting.

Example: customer

Possible values: merchant, customer

dataobjectrequired

The returned object, or an array of objects for a list.

methodsarray of objectrequired

One result for each method included in the preview.

payment_methodstringrequired

Payment method these fee calculations apply to.

Example: payment.qris

previewsarray of objectrequired

Fee 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.

metaobjectrequired

Request details such as its id and pagination cursor.

request_idstringrequired

The 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
]
}'