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
| Parameter | Data type | Description | Example | Required? |
|---|---|---|---|---|
projectId | UUID | Project ID in UUID format | 1c48b092-9878-48f5-b441-07a8a48e7b54 | yes |
amountFiat | Float | Amount in fiat currency | 10.55 | yes |
currencyFiat | String | Fiat currency. Allowed values: USD, EUR, RUB | EUR | yes |
description | String | Description of the product or service. Shown to the customer on the payment page | 12 months license for BITSBY | no |
serviceData | String | Order 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 |
timeToPay | Float | Time to pay the invoice, in hours. Allowed values: 0.5, 1, 3, 6, 12 | 1 | yes |
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
| Parameter | Description |
|---|---|
id | Invoice ID in UUID format |
uid | Invoice ID (for the customer) |
createDatetime | Invoice creation date and time (UTC) |
timeToPayDatetime | Date and time until which the invoice is valid (UTC). The customer must pay the invoice before this time |
commissionFiatUSD | Service fee amount. Calculated from the amountFiatUSD amount |
amountFiatUSD | Amount in USD, calculated at invoice creation from invoice.amountFiat at the current exchange rate |
url | Link to the payment page for the customer. Send this link to the customer to pay the invoice |