Fees
This object represents fees or commissions associated with a specific transaction or product. Use it to manage the various fees charged to your customers.
Scopes
fees:write
fees.read
Basics
A fee must be unique by name.
Create a fee
Create a new fee. Requires the fees:write
scope.
POST https://api.smartbills.io/v1/fees
Request Body
Requires a body of type FeeCreateRequest
Parameter | Description | Type | Required |
---|---|---|---|
name | Name of the fee | string | required |
description | Description of the fee | string | optional |
amount | Amount of the fee | SBMoney | required |
type | Type of fee | SBFeeType | optional |
category | Category of fee | SBFeeCategory | optional |
percentage | Percentage of the fee | number | optional |
locale | Locale of the fee | string | optional |
translations | Translations | array | optional |
{
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
"translations": [
{
"name": "Service Fee",
"description": "Fee for service",
"locale":"fr-CA"
}
]
}
Response
Returns an SBFee
{
"id": 1,
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
"translations": [
{
"name": "Service Fee",
"description": "Fee for service",
"locale":"fr-CA"
}
]
}
Code Example
import { SBClient, SBFee, FeeCreateRequest } from "@smartbills/sdk"
const client: SBClient = new SBClient();
const request: FeeCreateRequest = {
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
"translations": [
{
"name": "Service Fee",
"description": "Fee for service",
"locale":"fr-CA"
}
]
};
const fee: SBFee = await client.fees.create(request);
Retrieve a fee
Retrieve a fee by ID. Requires the fees.read
scope.
GET https://api.smartbills.io/v1/fees/:id
Path Parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the fee to retrieve | long | required |
Response
Returns an SBFee
{
"id": 1,
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
}
Code Example
import { SBClient, SBFee } from "@smartbills/sdk"
const client:SBClient = new SBClient();
const fee: SBFee = await client.fees.getByIdAsync(1);
List fees
Retrieve a list of fees. Requires the fees.read
scope.
GET https://api.smartbills.io/v1/fees?page=1&pageSize=100
Query Parameters
Requires query parameters of type SBListRequest
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
page | Current page | long | required | 1 |
pageSize | Number of records to return | long | required | 100 |
{
"page": 1,
"pageSize": 100
}
Response
Returns an SBList<SBFee>
{
"data": [{
"id": 1,
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
}],
"metadata": {
"page":1,
"pageSize":100,
"totalPages":1,
"count":1
}
}
Code Example
import { SBClient, SBFee, SBList, SBListRequest } from "@smartbills/sdk"
const client = new SBClient();
const request: SBListRequest = {
"page": 1,
"pageSize": 100
};
const fees: SBList<SBFee> = await client.fees.list(request);
Update a fee
Update the information of a fee. Requires the fees.write
scope.
PUT https://api.smartbills.io/v1/fees/:id
Path Parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the fee to update | long | required |
Request Body
Requires a body of type FeeUpdateRequest
Parameter | Description | Type | Required |
---|---|---|---|
name | Name of the fee | string | required |
description | Description of the fee | string | optional |
amount | Amount of the fee | SBMoney | required |
type | Type of fee | SBFeeType | optional |
category | Category of fee | SBFeeCategory | optional |
percentage | Percentage of the fee | number | optional |
locale | Locale of the fee | string | optional |
{
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
}
Response
Returns an SBFee
{
"id": 1,
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
"defaultTranslation": {
"name": "Service Fee",
"description": "Fee for service"
},
"translations": [
{
"name": "Service Fee",
"description": "Fee for service"
}
]
}
Code Example
import { SBClient, SBFee, FeeUpdateRequest } from "@smartbills/sdk"
const client:SBClient = new SBClient();
const request: FeeUpdateRequest = {
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
};
const fee: SBFee = await client.fees.update(1, request);
Delete a fee
Delete a fee. Requires the fees.write
scope.
DELETE https://api.smartbills.io/v1/fees/:id
Path Parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the fee to delete | long | required |
Response
Returns an SBFee
{
"id": 1,
"name": "Service Fee",
"description": "Fee for service",
"amount": {
"value": 10.00,
"currency": "USD"
},
"type": "fixed",
"category": "service",
"percentage": null,
"locale": "en-CA",
}
Code Example
import { SBClient, SBFee } from "@smartbills/sdk"
const client:SBClient = new SBClient();
const fee: SBFee = await client.fees.delete(1);