Merchants
This object represents a merchant of your business. Use it to track receipts that belong to the same merchant.
merchants.read
merchants.write
Core principles
A merchant should be unique by website.
SBMerchant
Create a merchant
Create a new merchant. Requires scope merchants.write
POST https://api.smartbills.io/v1/merchants
Request Body
Requires body of type MerchantCreateRequest
Parameter | Description | Type | Required |
---|---|---|---|
name | Name of the merchant | string | required |
address | Address of the merchant | AddressRequest | required |
logo | URL of the merchant's logo | string | required |
timezone | Timezone of the merchant | string | required |
currency | Currency used by the merchant | string | required |
website | Website of the merchant | string | required |
phoneNumber | Phone number of the merchant | string | required |
locale | Locale of the merchant | string | required |
{
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"latitude": 43,
"longitude": -73
}
},
"logo": "string",
"timezone": "string",
"currency": "string",
"website": "string",
"phoneNumber": "string",
"locale": "string"
}
Response
Returns a SBMerchant
{
"id": 0,
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"latitude": -43.532,
"longitude": -73.154
},
"formattedAddress": "string"
},
"currency": "string",
"slug": "string",
"timezone": "string",
"website": "string",
"phoneNumber": "string",
"logo": "string",
"createdAt": "2025-01-21T00:56:42.273Z",
"updatedAt": "2025-01-21T00:56:42.273Z"
}
Code example
import { SBClient, SBMerchant, MerchantCreateRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
"name": "John's Store",
"address": {
"line1": "123 Main St",
"line2": "Suite 100",
"city": "Anytown",
"state": "CA",
"country": "USA",
"stateCode": "CA",
"countryCode": "US",
"postalCode": "12345",
"location": {
"latitude": 37.7749,
"longitude": -122.4194
}
},
"logo": "https://example.com/logo.png",
"timezone": "PST",
"currency": "USD",
"website": "https://example.com",
"phoneNumber": "555-555-5555",
"locale": "en-US"
};
const merchant = await client.merchant.create(request);
Retrieve merchant
Retrieve a merchant by ID. Requires scope merchants.read
GET https://api.smartbills.io/v1/merchants/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the merchant to retrieve | long | required |
Response
Returns a SBMerchant
{
"id": 0,
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"formattedAddress": "string"
},
"currency": "string",
"slug": "string",
"timezone": "string",
"website": "string",
"phoneNumber": "string",
"logo": "string",
"createdAt": "2025-01-21T00:56:42.273Z",
"updatedAt": "2025-01-21T00:56:42.273Z"
}
Code example
import { SBClient, SBMerchant } from "@smartbills/sdk"
const client = new SBClient();
const merchant = await client.merchant.getByIdAsync(1);
List merchants
Retrieve a list of merchants. Requires scope merchants.read
GET https://api.smartbills.io/v1/merchants?page=1&pageSize=100
Query parameters
Requires query parameters of type MerchantListRequest
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
page | Current page | long | required | 1 |
pageSize | Number of records to return | long | required | 100 |
orderBy | Order the results by a key of SBMerchant | keyof SBMerchant | createdAt | |
sortOrder | Order of the sort | asc or desc | desc |
{
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc",
}
Response
Returns a SBList<SBMerchant>
{
"data": [{
"id": 0,
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"latitude": -43.532,
"longitude": -73.154
},
"formattedAddress": "string"
},
"currency": "string",
"slug": "string",
"timezone": "string",
"website": "string",
"phoneNumber": "string",
"logo": "string",
"createdAt": "2025-01-21T00:56:42.273Z",
"updatedAt": "2025-01-21T00:56:42.273Z"
}],
"metadata": {
"page": 1,
"pageSize": 100,
"totalPages": 1,
"count": 1
}
}
Code example
import { SBClient, SBMerchant, SBList, MerchantListRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc"
};
const merchants = await client.merchant.list(request);
Update a merchant
Update information about a merchant. Requires scope merchants.write
PUT https://api.smartbills.io/v1/merchants/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the merchant to update | long | required |
Body parameters
Requires a body of type MerchantUpdateRequest
Parameter | Description | Type | Required |
---|---|---|---|
name | Name of the merchant | string | required |
address | Address of the merchant | AddressRequest | required |
logo | URL of the merchant's logo | string | required |
timezone | Timezone of the merchant | string | required |
currency | Currency used by the merchant | string | required |
website | Website of the merchant | string | required |
phoneNumber | Phone number of the merchant | string | required |
locale | Locale of the merchant | string | required |
{
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"latitude": 43,
"longitude": -73
}
},
"logo": "string",
"timezone": "string",
"currency": "string",
"website": "string",
"phoneNumber": "string",
"locale": "string"
}
Response
Returns a SBMerchant
{
"id": 0,
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"latitude": -43.532,
"longitude":-73.154
},
"formattedAddress": "string"
},
"currency": "string",
"slug": "string",
"timezone": "string",
"website": "string",
"phoneNumber": "string",
"logo": "string",
"createdAt": "2025-01-21T00:56:42.273Z",
"updatedAt": "2025-01-21T00:56:42.273Z"
}
Code example
import { SBClient, SBMerchant, MerchantUpdateRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
"name": "John's Store Updated",
"address": {
"line1": "123 Main St",
"line2": "Suite 100",
"city": "Anytown",
"state": "CA",
"country": "USA",
"stateCode": "CA",
"countryCode": "US",
"postalCode": "12345",
"location": {
"latitude": 37.7749,
"longitude": -122.4194
}
},
"logo": "https://example.com/logo.png",
"timezone": "PST",
"currency": "USD",
"website": "https://example.com",
"phoneNumber": "555-555-5555",
"locale": "en-US"
};
const merchant = await client.merchants.updateAsync(1, request);
Delete a merchant
Delete a merchant. Requires scope merchants.write
DELETE https://api.smartbills.io/v1/merchants/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the merchant to delete | long | required |
Response
Returns a SBMerchant
{
"id": 0,
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"formattedAddress": "string"
},
"currency": "string",
"slug": "string",
"timezone": "string",
"website": "string",
"phoneNumber": "string",
"logo": "string",
"createdAt": "2025-01-21T00:56:42.273Z",
"updatedAt": "2025-01-21T00:56:42.273Z"
}
Code example
import { SBClient, SBMerchant } from "@smartbills/sdk"
const client = new SBClient();
const merchant = await client.merchants.deleteAsync(1);