Receipts
This object represents a receipt in your system. Use it to track transactions and retrieve detailed information about them.
receipts.read
receipts.write
Basics
Original Receipt
Smartbills is easily implemented alongside your billing system, allowing you to continue operating as usual while providing consumers with their receipts in the Smartbills app.
Distributing the Receipt to the Smartbills Account
To ensure that your client receives their receipt in their Smartbills account, it is crucial to provide some information to locate them.
Known Client
If you know the client and they exist in your Smartbills database, you can provide the following information:
- Smartbills Client ID
- Email address
- Phone number
Unknown Client
If you do not know the client, you can provide the following information:
- Payment method information
- Credit card (BIN, last 4 digits of the credit card, cardholder name, expiration date)
- Virtual credit card (Same information as a credit card, dynamic last 4 digits, wallet type)
- Bank account (Institution number, transit number, account number)
- Bank statement information
- Debited amount
- Transaction name on the bank statement
- Fingerprint and fingerprint provider
If you do not know the client, it is not possible to guarantee that the receipt will end up in the client’s Smartbills account.
SBReceipt
Create a Receipt
Create a new receipt. Requires the receipts.write
scope.
POST https://api.smartbills.io/v1/receipts
Request Body
Requires a body of type ReceiptCreateRequest
Property Name | Description | Type | Required |
---|---|---|---|
merchantId | Identifier of the merchant. | long? | No |
locationId | Identifier of the location. | long? | No |
location | Details of the location. | LocationCreateRequest | No |
customer | Customer details. | CustomerCreateRequest | No |
customerId | Identifier of the customer. | long? | No |
receiptId | Unique identifier for the receipt. | string? | No |
employeeId | Identifier of the employee associated. | long? | No |
billingAddress | Billing address details. | BillingAddressRequest | No |
shippingAddress | Shipping address details. | BillingAddressRequest | No |
items | List of items on the receipt. | List<ReceiptItemCreateRequest> | No |
fees | List of additional fees. | List<ReceiptFeeCreateRequest> | No |
currency | Currency code (e.g., USD). | string? | No |
date | Date of the receipt. | DateTime? | No |
dueDate | Due date for payment. | DateTime? | No |
cancelledAt | Date when the receipt was canceled. | DateTime? | No |
cancelReason | Reason for cancellation. | string? | No |
orderNumber | Order number related to the receipt. | string? | No |
paymentStatus | Payment status (e.g., Paid, Pending). | string? | No |
discounts | List of discounts applied. | List<ReceiptDiscountCreateRequest> | No |
taxes | List of taxes applied. | List<ReceiptTaxCreateRequest> | No |
taxesIncluded | Whether taxes are included in the total. | bool | Yes |
totalDiscounts | Total discounts amount. | SBMoney | Yes |
totalFees | Total fees amount. | SBMoney | Yes |
subTotal | Subtotal amount before taxes and discounts. | SBMoney | Yes |
totalTip | Total tip amount. | SBMoney | Yes |
totalDuties | Total duties amount. | SBMoney | Yes |
totalShipping | Total shipping charges. | SBMoney | Yes |
totalTaxes | Total taxes amount. | SBMoney | Yes |
total | Final total amount. | SBMoney | Yes |
totalWeight | Total weight of the items. | double? | No |
weightUnit | Weight unit. | string | No |
source | Source of the receipt. | string? | No |
type | Type of receipt. | SBReceiptType | Yes |
receiptMetadata | Additional metadata for the receipt. | ReceiptMetadataCreateRequest | No |
payments | Payment details. | List<ReceiptPaymentCreateRequest> | No |
barcode | Barcode information. | BarcodeCreateRequest | No |
originalReceiptUrl | URL of the original receipt. | string? | No |
review | Review details of the receipt. | ReceiptReviewCreateRequest | No |
signature | Signature details for authorization. | ImageRequest | No |
billingPeriodStartDate | Start date of the billing period. | DateTime? | No |
billingPeriodEndDate | End date of the billing period. | DateTime? | No |
totalPayments | Total payments amount. | SBMoney | Yes |
{
"merchantId": 0,
"locationId": 0,
"location": {
"name": "string",
"description": "string",
"merchantCategoryCode": "string",
"currency": "string",
"timezone": "string",
"phoneNumber": "string",
"website": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string"
},
"facebookUrl": "string",
"instagramUsername": "string",
"twitterUsername": "string",
"isActive": true,
"locale": "string",
"email": "string",
"logo": "string",
"images": [
{
"name": "string",
"url": "string",
"base64": "string",
"stream": "string"
}
]
},
"customer": {
"firstName": "string",
"lastName": "string",
"email": "string",
"companyName": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"billingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"shippingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"isTaxExempt": true,
"tags": [
"string"
],
"currency": "string",
"acceptsMarketing": true,
"phoneNumber": "string",
"nickname": "string",
"note": "string",
"locale": "string",
"accountNumber": "string",
"customerNumber": "string",
"birthDate": "2025-01-21T18:54:48.245Z",
"metadata": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
},
"customerId": 0,
"receiptId": "string",
"employeeId": 0,
"billingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"shippingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country": "string",
"stateCode": "string",
"countryCode": "string",
"postalCode": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"items": [
{
"productId": 0,
"price": {
"amount": 0,
"currency": "string"
},
"description": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"variantId": 0,
"quantity": 0,
"subTotal": {
"amount": 0,
"currency": "string"
},
"totalDiscounts": {
"amount": 0,
"currency": "string"
},
"totalDuties": {
"amount": 0,
"currency": "string"
},
"total": {
"amount": 0,
"currency": "string"
},
"totalTaxes": {
"amount": 0,
"currency": "string"
},
"taxes": [
{
"taxId": 0,
"name": "string",
"amount": 0,
"percentage": 0
}
],
"discounts": [
{
"promoCodeId": 0,
"amount": {
"amount": 0,
"currency": "string"
},
"percentage": 0,
"type": "PERCENTAGE",
"name": "string"
}
],
"taxable": true
}
],
"fees": [
{
"feeId": 0,
"amount": 0,
"rate": 0,
"total": 0,
"type": "string"
}
],
"currency": "string",
"date": "2025-01-21T18:54:48.245Z",
"dueDate": "2025-01-21T18:54:48.245Z",
"cancelledAt": "2025-01-21T18:54:48.245Z",
"cancelReason": "string",
"orderNumber": "string",
"paymentStatus": "string",
"discounts": [
{
"promoCodeId": 0,
"receiptId": 0,
"amount": 0,
"name": "string",
"percentage": 0
}
],
"taxes": [
{
"name": "string",
"percentage": 0,
"total": {
"amount": 0,
"currency": "string"
},
"taxIdentificationNumber": "string"
}
],
"taxesIncluded": true,
"totalDiscounts": {
"amount": 0,
"currency": "string"
},
"totalFees": {
"amount": 0,
"currency": "string"
},
"subTotal": {
"amount": 0,
"currency": "string"
},
"totalTip": {
"amount": 0,
"currency": "string"
},
"totalDuties": {
"amount": 0,
"currency": "string"
},
"totalShipping": {
"amount": 0,
"currency": "string"
},
"totalTaxes": {
"amount": 0,
"currency": "string"
},
"total": {
"amount": 0,
"currency": "string"
},
"totalWeight": 0,
"source": "string",
"type": "OFFICIAL",
"receiptMetadata": {
"landingSite": "string",
"customerLocale": "string",
"refferingSite": "string",
"sourcePOS": "string",
"sourceName": "string",
"tags": "string",
"url": "string",
"browserMetadata": {
"acceptLanguage": "string",
"browserHeight": 0,
"browserIp": "string",
"browserWidth": 0,
"sessionHash": "string",
"userAgent": "string"
}
},
"payments": [
{
"receiptId": 0,
"statementDescriptor": "string",
"card": {
"authorizationCode": "string",
"statementDescriptor": "string",
"paymentMethod": {
"cardholderName": "string",
"cardholderFirstName": "string",
"cardholderLastName": "string",
"country": "string",
"brand": "string",
"coBrand": "string",
"expirationMonth": 0,
"expirationYear": 0,
"last4": "string",
"dynamicLast4": "string",
"bin": "string",
"fingerprint": {
"fingerprint": "string",
"provider": "STRIPE"
}
},
"method": "MANUAL",
"emv": {
"applicationId": "string",
"applicationName": "string",
"applicationCryptogram": "string",
"cardholderVerificationMethod": "string",
"cardholderVerificationResult": "string"
},
"cvv": "CVV_MATCHED",
"avs": "POSTAL_CODE_ADDRESS_MATCHED",
"timeline": {
"authorizedAt": "2025-01-21T18:54:48.245Z",
"capturedAt": "2025-01-21T18:54:48.245Z",
"voidedAt": "2025-01-21T18:54:48.245Z"
}
},
"cash": {
"supplied": {
"amount": 0,
"currency": "string"
},
"change": {
"amount": 0,
"currency": "string"
}
},
"bankAccount": {
"bankName": "string",
"accountNumber": "string",
"routingNumber": "string",
"accountType": "string",
"fingerprint": "string",
"statementDescriptor": "string",
"countryCode": "string"
},
"external": {
"source": "string",
"sourceId": "string",
"fee": {
"id": 0,
"currency": "string",
"amount": 0
},
"type": "CHECK"
},
"billingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"shippingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"type": "CARD",
"amount": {
"amount": 0,
"currency": "string"
},
"tip": {
"amount": 0,
"currency": "string"
},
"applicationFee": {
"amount": 0,
"currency": "string"
},
"total": {
"amount": 0,
"currency": "string"
},
"approuved": {
"amount": 0,
"currency": "string"
},
"refunded": {
"amount": 0,
"currency": "string"
},
"status": "APPROUVED",
"receiptNumber": "string",
"receiptUrl": "string",
"note": "string",
"riskEvaluation": {
"riskLevel": "NORMAL",
"riskScore": 0
},
"refunds": [
]
}
],
"barcode": {
"type": "AZTEC",
"value": "string"
},
"originalReceiptUrl": "string",
"review": {
"rating": 0,
"review": "string",
},
"signature": {
"name": "string",
"url": "string",
"base64": "string",
"stream": "string"
},
"billingPeriodStartDate": "2025-01-21T18:54:48.245Z",
"billingPeriodEndDate": "2025-01-21T18:54:48.245Z",
"totalPayments": {
"amount": 0,
"currency": "string"
}
}
Response
Returns an SBReceipt
{
"id": 0,
"merchant": {
"id": 0,
"name": "string",
"slug": "string",
"customerEmail": "string",
"phoneNumber": "string",
"website": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"logo": "string"
},
"location": {
"id": 0,
"logo": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"phoneNumber": "string",
"images": [
{
"id": 0,
"name": "string",
"url": "string",
"height": 0,
"width": 0,
"createdAt": "2025-01-21T18:56:03.661Z",
"updatedAt": "2025-01-21T18:56:03.661Z"
}
],
"facebookUrl": "string",
"twitterUsername": "string",
"instagramUsername": "string",
"merchantCategoryCode": "string",
"timezone": "string"
},
"items": [
{
"id": 0,
"product": {
"id": 0,
"name": "string",
"slug": "string",
"category": "string"
},
"productId": 0,
"variantId": 0,
"quantity": 0,
"price": {
"amount": 0,
"currency": "string"
},
"totalDiscounts": {
"amount": 0,
"currency": "string"
},
"totalDuties": {
"amount": 0,
"currency": "string"
},
"totalTaxes": {
"amount": 0,
"currency": "string"
},
"subTotal": {
"amount": 0,
"currency": "string"
},
"total": {
"amount": 0,
"currency": "string"
},
"discounts": [
{
"id": 0,
"promoCodeId": 0,
"amount": {
"amount": 0,
"currency": "string"
},
"percentage": 0,
"type": "PERCENTAGE",
"name": "string"
}
],
"taxes": [
{
"taxId": 0,
"name": "string",
"percentage": 0,
"total": {
"amount": 0,
"currency": "string"
}
}
],
"variant": {
"id": 0,
"initialPrice": 0,
"price": 0,
"weightUnit": "string",
"weight": 0,
"taxable": true,
"name": "string",
"sku": "string",
"upc": "string",
"createdAt": "2025-01-21T18:56:03.661Z",
"updatedAt": "2025-01-21T18:56:03.661Z",
"productId": 0
},
"individualShares": [
{
"id": 0,
"userId": 0,
"quantity": 0,
"percentage": 0,
"subTotal": 0,
"totalTaxes": 0,
"total": 0,
"user": {
"id": 0,
"avatar": "string",
"name": "string",
"firstName": "string",
"lastName": "string",
"username": "string",
"email": "string"
}
}
]
}
],
"totalItems": {
"amount": 0,
"currency": "string"
},
"totalPayments": {
"amount": 0,
"currency": "string"
},
"totalDiscounts": {
"amount": 0,
"currency": "string"
},
"totalDuties": {
"amount": 0,
"currency": "string"
},
"totalShipping": {
"amount": 0,
"currency": "string"
},
"totalTip": {
"amount": 0,
"currency": "string"
},
"totalFees": {
"amount": 0,
"currency": "string"
},
"subTotal": {
"amount": 0,
"currency": "string"
},
"totalTaxes": {
"amount": 0,
"currency": "string"
},
"total": {
"amount": 0,
"currency": "string"
},
"payments": [
{
"id": 0,
"billingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"shippingAddress": {
"firstName": "string",
"lastName": "string",
"name": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"stateCode": "string",
"country": "string",
"countryCode": "string",
"postalCode": "string",
"location": {
"longitude": 0,
"latitude": 0
},
"googlePlaceId": "string",
"formattedAddress": "string"
},
"comapny": "string",
"phoneNumber": "string",
"email": "string"
},
"type": "CARD",
"statementDescriptor": "string",
"card": {
"authorizationCode": "string",
"statementDescriptor": "string",
"method": "MANUAL",
"emv": {
"applicationId": "string",
"applicationName": "string",
"applicationCryptogram": "string",
"cardholderVerificationMethod": "string",
"cardholderVerificationResult": "string"
},
"paymentMethod": {
"cardholderName": "string",
"cardholderFirstName": "string",
"cardholderLastName": "string",
"country": "string",
"brand": "string",
"coBrand": "string",
"expirationMonth": 0,
"expirationYear": 0,
"last4": "string",
"dynamicLast4": "string",
"bin": "string",
"fingerprint": {
"fingerprint": "string",
"provider": "STRIPE"
}
},
"cvv": "CVV_MATCHED",
"avs": "POSTAL_CODE_ADDRESS_MATCHED",
"timeline": {
"authorizedAt": "2025-01-21T18:56:03.662Z",
"capturedAt": "2025-01-21T18:56:03.662Z",
"voidedAt": "2025-01-21T18:56:03.662Z"
}
},
"cash": {
"cashGiven": {
"amount": 0,
"currency": "string"
},
"changeReturned": {
"amount": 0,
"currency": "string"
}
},
"note": "string",
"amount": {
"amount": 0,
"currency": "string"
},
"tip": {
"amount": 0,
"currency": "string"
},
"applicationFee": {
"amount": 0,
"currency": "string"
},
"total": {
"amount": 0,
"currency": "string"
},
"approuved": {
"amount": 0,
"currency": "string"
},
"refunded": {
"amount": 0,
"currency": "string"
},
"paymentProcessingFee": [
{
"type": "INITIAL",
"amount": {
"amount": 0,
"currency": "string"
}
}
],
"status": "APPROUVED",
"receiptNumber": "string",
"receiptUrl": "string",
"riskEvaluation": {
"riskLevel": "NORMAL",
"riskScore": 0
},
"refunds": [
{
"id": 0
}
]
}
],
"taxes": [
{
"id": 0,
"total": 0,
"taxIdentificationNumber": "string",
"rate": 0,
"name": "string",
"tax": {
"id": 0,
"isActive": true,
"country": "string",
"description": "string",
"name": "string",
"taxType": "CA_BN",
"percentage": 0,
"state": "string",
"inclusive": true,
"taxIdentificationNumber": "string",
"merchantId": 0
}
}
],
"receiptId": "string",
"type": "OFFICIAL",
"documents": [
{
"id": 0,
"name": "string",
"url": "string",
"createdAt": "2025-01-21T18:56:03.662Z",
"updatedAt": "2025-01-21T18:56:03.662Z",
"userId": 0
}
],
"bankTransaction": {
"id": 0,
"amount": 0,
"categories": [
"string"
],
"date": "2025-01-21T18:56:03.662Z",
"name": "string",
"paymentChannel": "string"
},
"date": "2025-01-21T18:56:03.662Z",
"cancelledAt": "2025-01-21T18:56:03.662Z",
"dueDate": "2025-01-21T18:56:03.662Z",
"closedAt": "2025-01-21T18:56:03.662Z",
"createdAt": "2025-01-21T18:56:03.662Z",
"url": "string"
}
Code Example
import { SBClient, SBReceipt, ReceiptCreateRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
merchantId: 1,
totalAmount: 100.00,
currency: "USD",
items: [
{ name: "Item 1", quantity: 1, price: 50.00 },
{ name: "Item 2", quantity: 1, price: 50.00 }
],
paymentMethod: "Credit Card",
date: "2025-01-21T00:56:42.273Z"
};
const receipt = await client.receipts.create(request);
Retrieve a Receipt
Retrieve a receipt by ID. Requires the receipts.read
scope.
GET https://api.smartbills.io/v1/receipts/:id
Path Parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the receipt to retrieve | long | required |
Response
Returns an SBReceipt
{
"id": 1,
"merchant": {
"id": 1,
"name": "Merchant Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"location": {
"id": 1,
"name": "Location Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"items": [
{
"id": 1,
"name": "Item 1",
"quantity": 1,
"price": 50.00
},
{
"id": 2,
"name": "Item 2",
"quantity": 1,
"price": 50.00
}
],
"totalItems": {
"amount": 100.00,
"currency": "USD"
},
"totalPayments": {
"amount": 100.00,
"currency": "USD"
},
"totalDiscounts": {
"amount": 0.00,
"currency": "USD"
},
"totalDuties": {
"amount": 0.00,
"currency": "USD"
},
"totalShipping": {
"amount": 0.00,
"currency": "USD"
},
"totalTip": {
"amount": 0.00,
"currency": "USD"
},
"totalFees": {
"amount": 0.00,
"currency": "USD"
},
"subTotal": {
"amount": 100.00,
"currency": "USD"
},
"totalTaxes": {
"amount": 0.00,
"currency": "USD"
},
"total": {
"amount": 100.00,
"currency": "USD"
},
"payments": [
{
"id": 1,
"method": "Credit Card",
"amount": {
"amount": 100.00,
"currency": "USD"
}
}
],
"taxes": [],
"receiptId": "12345",
"type": "SALE",
"documents": [],
"bankTransaction": null,
"date": "2025-01-21T00:56:42.273Z",
"cancelledAt": null,
"dueDate": null,
"closedAt": null,
"createdAt": "2025-01-21T00:56:42.273Z",
"url": null
}
Code Example
import { SBClient, SBReceipt } from "@smartbills/sdk"
const client = new SBClient();
const receipt = await client.receipts.getById(1);
List Receipts
Retrieve a list of receipts. Requires the receipts.read
scope.
GET https://api.smartbills.io/v1/receipts?page=1&pageSize=100
Query Parameters
Requires query parameters of type ReceiptListRequest
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
page | Current page | long | required | 1 |
pageSize | Number of records to return | long | required | 100 |
orderBy | Sort results by a key of SBReceipt | keyof SBReceipt | createdAt | |
sortOrder | Sort order | asc or desc | desc |
{
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc"
}
Response
Returns an SBList<SBReceipt>
{
"data": [{
"id": 1,
"merchant": {
"id": 1,
"name": "Merchant Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"location": {
"id": 1,
"name": "Location Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"items": [
{
"id": 1,
"name": "Item 1",
"quantity": 1,
"price": 50.00
},
{
"id": 2,
"name": "Item 2",
"quantity": 1,
"price": 50.00
}
],
"totalItems": {
"amount": 100.00,
"currency": "USD"
},
"totalPayments": {
"amount": 100.00,
"currency": "USD"
},
"totalDiscounts": {
"amount": 0.00,
"currency": "USD"
},
"totalDuties": {
"amount": 0.00,
"currency": "USD"
},
"totalShipping": {
"amount": 0.00,
"currency": "USD"
},
"totalTip": {
"amount": 0.00,
"currency": "USD"
},
"totalFees": {
"amount": 0.00,
"currency": "USD"
},
"subTotal": {
"amount": 100.00,
"currency": "USD"
},
"totalTaxes": {
"amount": 0.00,
"currency": "USD"
},
"total": {
"amount": 100.00,
"currency": "USD"
},
"payments": [
{
"id": 1,
"method": "Credit Card",
"amount": {
"amount": 100.00,
"currency": "USD"
}
}
],
"taxes": [],
"receiptId": "12345",
"type": "SALE",
"documents": [],
"bankTransaction": null,
"date": "2025-01-21T00:56:42.273Z",
"cancelledAt": null,
"dueDate": null,
"closedAt": null,
"createdAt": "2025-01-21T00:56:42.273Z",
"url": null
}],
"metadata": {
"page": 1,
"pageSize": 100,
"totalPages": 1,
"count": 1
}
}
Code Example
import { SBClient, SBReceipt, SBList, ReceiptListRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
page: 1,
pageSize: 100,
orderBy: "createdAt",
sortOrder: "desc"
};
const receipts = await client.receipts.list(request);
Update a Receipt
Update the information of a receipt. Requires the receipts.write
scope.
PUT https://api.smartbills.io/v1/receipts/:id
Path Parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the receipt to update | long | required |
Request Body
Requires a body of type ReceiptUpdateRequest
Parameter | Description | Type | Required |
---|---|---|---|
merchantId | ID of the merchant | long | required |
totalAmount | Total amount of the receipt | number | required |
currency | Currency used in the receipt | string | required |
items | List of items in the receipt | array | required |
paymentMethod | Payment method used | string | required |
date | Date of the receipt | string | required |
{
"merchantId": 1,
"totalAmount": 100.00,
"currency": "USD",
"items": [
{
"name": "Item 1",
"quantity": 1,
"price": 50.00
},
{
"name": "Item 2",
"quantity": 1,
"price": 50.00
}
],
"paymentMethod": "Credit Card",
"date": "2025-01-21T00:56:42.273Z"
}
Response
Returns an SBReceipt
{
"id": 1,
"merchant": {
"id": 1,
"name": "Merchant Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"location": {
"id": 1,
"name": "Location Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"items": [
{
"id": 1,
"name": "Item 1",
"quantity": 1,
"price": 50.00
},
{
"id": 2,
"name": "Item 2",
"quantity": 1,
"price": 50.00
}
],
"totalItems": {
"amount": 100.00,
"currency": "USD"
},
"totalPayments": {
"amount": 100.00,
"currency": "USD"
},
"totalDiscounts": {
"amount": 0.00,
"currency": "USD"
},
"totalDuties": {
"amount": 0.00,
"currency": "USD"
},
"totalShipping": {
"amount": 0.00,
"currency": "USD"
},
"totalTip": {
"amount": 0.00,
"currency": "USD"
},
"totalFees": {
"amount": 0.00,
"currency": "USD"
},
"subTotal": {
"amount": 100.00,
"currency": "USD"
},
"totalTaxes": {
"amount": 0.00,
"currency": "USD"
},
"total": {
"amount": 100.00,
"currency": "USD"
},
"payments": [
{
"id": 1,
"method": "Credit Card",
"amount": {
"amount": 100.00,
"currency": "USD"
}
}
],
"taxes": [],
"receiptId": "12345",
"type": "SALE",
"documents": [],
"bankTransaction": null,
"date": "2025-01-21T00:56:42.273Z",
"cancelledAt": null,
"dueDate": null,
"closedAt": null,
"createdAt": "2025-01-21T00:56:42.273Z",
"url": null
}
Code Example
import { SBClient, SBReceipt, ReceiptUpdateRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
merchantId: 1,
totalAmount: 100.00,
currency: "USD",
items: [
{ name: "Item 1", quantity: 1, price: 50.00 },
{ name: "Item 2", quantity: 1, price: 50.00 }
],
paymentMethod: "Credit Card",
date: "2025-01-21T00:56:42.273Z"
};
const receipt = await client.receipts.update(1, request);
Delete a Receipt
Delete a receipt. Requires the receipts.write
scope.
DELETE https://api.smartbills.io/v1/receipts/:id
Path Parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the receipt to delete | long | required |
Response
Returns an SBReceipt
{
"id": 1,
"merchant": {
"id": 1,
"name": "Merchant Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"location": {
"id": 1,
"name": "Location Name",
"address": {
"line1": "123 Main St",
"city": "City",
"state": "State",
"country": "Country",
"postalCode": "12345"
}
},
"items": [
{
"id": 1,
"name": "Item 1",
"quantity": 1,
"price": 50.00
},
{
"id": 2,
"name": "Item 2",
"quantity": 1,
"price": 50.00
}
],
"totalItems": {
"amount": 100.00,
"currency": "USD"
},
"totalPayments": {
"amount": 100.00,
"currency": "USD"
},
"totalDiscounts": {
"amount": 0.00,
"currency": "USD"
},
"totalDuties": {
"amount": 0.00,
"currency": "USD"
},
"totalShipping": {
"amount": 0.00,
"currency": "USD"
},
"totalTip": {
"amount": 0.00,
"currency": "USD"
},
"totalFees": {
"amount": 0.00,
"currency": "USD"
},
"subTotal": {
"amount": 100.00,
"currency": "USD"
},
"totalTaxes": {
"amount": 0.00,
"currency": "USD"
},
"total": {
"amount": 100.00,
"currency": "USD"
},
"payments": [
{
"id": 1,
"method": "Credit Card",
"amount": {
"amount": 100.00,
"currency": "USD"
}
}
],
"taxes": [],
"receiptId": "12345",
"type": "SALE",
"documents": [],
"bankTransaction": null,
"date": "2025-01-21T00:56:42.273Z",
"cancelledAt": null,
"dueDate": null,
"closedAt": null,
"createdAt": "2025-01-21T00:56:42.273Z",
"url": null
}
Code Example
import { SBClient, SBReceipt } from "@smartbills/sdk"
const client = new SBClient();
const receipt = await client.receipts.delete(1);