Receipts API

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 NameDescriptionTypeRequired
merchantIdIdentifier of the merchant.long?No
locationIdIdentifier of the location.long?No
locationDetails of the location.LocationCreateRequestNo
customerCustomer details.CustomerCreateRequestNo
customerIdIdentifier of the customer.long?No
receiptIdUnique identifier for the receipt.string?No
employeeIdIdentifier of the employee associated.long?No
billingAddressBilling address details.BillingAddressRequestNo
shippingAddressShipping address details.BillingAddressRequestNo
itemsList of items on the receipt.List<ReceiptItemCreateRequest>No
feesList of additional fees.List<ReceiptFeeCreateRequest>No
currencyCurrency code (e.g., USD).string?No
dateDate of the receipt.DateTime?No
dueDateDue date for payment.DateTime?No
cancelledAtDate when the receipt was canceled.DateTime?No
cancelReasonReason for cancellation.string?No
orderNumberOrder number related to the receipt.string?No
paymentStatusPayment status (e.g., Paid, Pending).string?No
discountsList of discounts applied.List<ReceiptDiscountCreateRequest>No
taxesList of taxes applied.List<ReceiptTaxCreateRequest>No
taxesIncludedWhether taxes are included in the total.boolYes
totalDiscountsTotal discounts amount.SBMoneyYes
totalFeesTotal fees amount.SBMoneyYes
subTotalSubtotal amount before taxes and discounts.SBMoneyYes
totalTipTotal tip amount.SBMoneyYes
totalDutiesTotal duties amount.SBMoneyYes
totalShippingTotal shipping charges.SBMoneyYes
totalTaxesTotal taxes amount.SBMoneyYes
totalFinal total amount.SBMoneyYes
totalWeightTotal weight of the items.double?No
weightUnitWeight unit.stringNo
sourceSource of the receipt.string?No
typeType of receipt.SBReceiptTypeYes
receiptMetadataAdditional metadata for the receipt.ReceiptMetadataCreateRequestNo
paymentsPayment details.List<ReceiptPaymentCreateRequest>No
barcodeBarcode information.BarcodeCreateRequestNo
originalReceiptUrlURL of the original receipt.string?No
reviewReview details of the receipt.ReceiptReviewCreateRequestNo
signatureSignature details for authorization.ImageRequestNo
billingPeriodStartDateStart date of the billing period.DateTime?No
billingPeriodEndDateEnd date of the billing period.DateTime?No
totalPaymentsTotal payments amount.SBMoneyYes
ReceiptCreateRequest
{
  "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

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

ParameterDescriptionTypeRequired
idID of the receipt to retrievelongrequired

Response

Returns an SBReceipt

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

ParameterDescriptionTypeRequiredDefault
pageCurrent pagelongrequired1
pageSizeNumber of records to returnlongrequired100
orderBySort results by a key of SBReceiptkeyof SBReceiptcreatedAt
sortOrderSort orderasc or descdesc
ReceiptListRequest
{
    "page": 1,
    "pageSize": 100,
    "orderBy": "createdAt",
    "sortOrder": "desc"
}

Response

Returns an SBList<SBReceipt>

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

ParameterDescriptionTypeRequired
idID of the receipt to updatelongrequired

Request Body

Requires a body of type ReceiptUpdateRequest

ParameterDescriptionTypeRequired
merchantIdID of the merchantlongrequired
totalAmountTotal amount of the receiptnumberrequired
currencyCurrency used in the receiptstringrequired
itemsList of items in the receiptarrayrequired
paymentMethodPayment method usedstringrequired
dateDate of the receiptstringrequired
ReceiptUpdateRequest
{
  "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

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

ParameterDescriptionTypeRequired
idID of the receipt to deletelongrequired

Response

Returns an SBReceipt

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