Skip to main content

Create an invoice

Request

curl -X POST https://api.bitsby.app/invoices/create \
-H "Authorization: Token MSvL2ltaDZdWVjmZURURMVWhqSJLT2NURjhL2Fla1Z1T1IxQTltKs1T3Ay" \
-F "projectId=9deea1e2-0c08-41a3-bdc2-a34eada3892d" \
-F "amountFiat=10.55" \
-F "currencyFiat=EUR" \
-F "description=12 months license for BITSBY" \
-F "serviceData={\"userId\":100,\"orderId\":500}" \
-F "timeToPay=12"

Request parameters

ParameterData typeDescriptionExampleRequired?
projectIdUUIDProject ID in UUID format1c48b092-9878-48f5-b441-07a8a48e7b54yes
amountFiatFloatAmount in fiat currency10.55yes
currencyFiatStringFiat currency. Allowed values: USD, EUR, RUBEURyes
descriptionStringDescription of the product or service. Shown to the customer on the payment page12 months license for BITSBYno
serviceDataStringOrder identifier on the store side. Not shown to the customer. This data associates the invoice and payment with the customer in the merchant's store. JSON is a convenient format for it{"userId":100,"orderId":500}no
timeToPayFloatTime to pay the invoice, in hours. Allowed values: 0.5, 1, 3, 6, 121yes

Response example

{
"result":"success",
"data":{
"id":"ade9550d-3dc7-4fd3-b94e-3b4c12aaaa0c",
"uid":"MXNj4m8HhcM4",
"createDatetime":"2024-02-29 15:20:24",
"timeToPayDatetime":"2024-03-01 03:20:24",
"commissionFiatUSD":0.1,
"amountFiatUSD":10,
"url":"https:\/\/dash.bitsby.app\/invoices\/pay\/MXNj4m8HhcM4"
}
}

Response parameters

ParameterDescription
idInvoice ID in UUID format
uidInvoice ID (for the customer)
createDatetimeInvoice creation date and time (UTC)
timeToPayDatetimeDate and time until which the invoice is valid (UTC). The customer must pay the invoice before this time
commissionFiatUSDService fee amount. Calculated from the amountFiatUSD amount
amountFiatUSDAmount in USD, calculated at invoice creation from invoice.amountFiat at the current exchange rate
urlLink to the payment page for the customer. Send this link to the customer to pay the invoice