Fees API

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

ParameterDescriptionTypeRequired
nameName of the feestringrequired
descriptionDescription of the feestringoptional
amountAmount of the feeSBMoneyrequired
typeType of feeSBFeeTypeoptional
categoryCategory of feeSBFeeCategoryoptional
percentagePercentage of the feenumberoptional
localeLocale of the feestringoptional
translationsTranslationsarrayoptional
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"
        }
    ]
}

Response

Returns an SBFee

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

ParameterDescriptionTypeRequired
idID of the fee to retrievelongrequired

Response

Returns an SBFee

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

ParameterDescriptionTypeRequiredDefault
pageCurrent pagelongrequired1
pageSizeNumber of records to returnlongrequired100
SBListRequest
{
    "page": 1,
    "pageSize": 100
}

Response

Returns an SBList<SBFee>

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

ParameterDescriptionTypeRequired
idID of the fee to updatelongrequired

Request Body

Requires a body of type FeeUpdateRequest

ParameterDescriptionTypeRequired
nameName of the feestringrequired
descriptionDescription of the feestringoptional
amountAmount of the feeSBMoneyrequired
typeType of feeSBFeeTypeoptional
categoryCategory of feeSBFeeCategoryoptional
percentagePercentage of the feenumberoptional
localeLocale of the feestringoptional
FeeUpdateRequest
{
    "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

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

ParameterDescriptionTypeRequired
idID of the fee to deletelongrequired

Response

Returns an SBFee

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);