Transactions

Create or update transaction

Given the details of an invoice, calculate sales tax and save it as a transaction in Anrok. Saved transactions are used by Anrok to file sales tax returns and monitor sales thresholds.

post/v1/seller/transactions/createOrUpdate

Request

  • Base URL: https://api.anrok.com
  • URL: https://api.anrok.com/v1/seller/transactions/createOrUpdate
  • Auth: HTTP bearer

Request body

currencyCodestring required

Three letter ISO currency code (case insensitive).

customerNamestring

The name of the customer. This is used for display purposes only.

customerEmailAddressstring email

The email address of the customer. This is used for display purposes only.

accountingDatestring date

The date that this transaction occurred, for accounting purposes. Accounting date will typically correspond to the invoice date. This is used to determine which tax return the transaction belongs to.

accountingTimestring date-time

The time that this transaction occurred, for accounting purposes. If accountingDate is not provided, accountingTime is required to compute an accounting date for the transaction.

accountingTimeZone'UTC' | 'America/New_York' | 'America/Chicago' | 'America/Denver' | 'America/Los_Angeles' | 'America/Anchorage' | 'Pacific/Honolulu' | 'Australia/Perth' | 'Australia/Adelaide' | 'Australia/Darwin' | 'Australia/Brisbane' | 'Australia/Sydney' | 'America/Halifax' | 'America/Toronto' | 'America/Winnipeg' | 'America/Regina' | 'America/Edmonton' | 'America/Vancouver' | 'Europe/Berlin' | 'Europe/Brussels' | 'Europe/Dublin' | 'Europe/Helsinki' | 'Europe/London' | 'Europe/Paris' | 'Europe/Rome' | 'Europe/Stockholm' | 'Asia/Tokyo' | 'Asia/Singapore'

A “tz database” string used to compute an accounting date from the request's accountingTime. The request cannot provide both an accountingDate and an accountingTimeZone. If accountingTime is provided without specifying an accountingTimeZone, the time zone configured on the seller account will be used.

taxDatestring date

The date to use for tax calculations. If omitted, Anrok will use the accounting date.

userFriendlyIdstring

Optional. A human-readable ID for the transaction. This is typically the invoice number displayed in your billing system.

taxAmountAddedinteger

Optional. The total amount of tax already on this invoice, in the smallest denomination of the currency (e.g. cents). Not used for tax calculation; Anrok compares this against the tax it calculates in order to track tax discrepancies. If omitted, Anrok does not calculate tax discrepancies.

customerIdstring

The Anrok customer ID used to link transactions for the same customer and to look up tax exemption certificates for a customer. This is typically the billing system's customer ID with a prefix to disambiguate.

  • If customerId is provided without customerName, that customer object must already exist in Anrok.
  • If both customerId and customerName are provided, the customer object will be created if it is not already present.
  • Customer IDs are unique across the entire seller account.
idstring required

The ID of the new transaction. This must be unique across the entire seller account. This is typically the billing system's invoice ID with some prefix to disambiguate different systems.

Example request

{
  "currencyCode": "USD",
  "customerAddress": {
    "country": "ENGLAND",
    "line1": "2045 ROYAL ROAD",
    "city": "LONDON",
    "postalCode": "WIP 6HQ"
  },
  "customerName": "Acme Inc",
  "customerEmailAddress": "john.doe@example.com",
  "shipFromAddress": {
    "country": "ENGLAND",
    "line1": "2045 ROYAL ROAD",
    "city": "LONDON",
    "postalCode": "WIP 6HQ"
  },
  "accountingDate": "2017-07-21",
  "accountingTime": "2017-07-21T17:32:28Z",
  "taxDate": "2017-07-21",
  "userFriendlyId": "INV-2706174",
  "taxAmountAdded": 200,
  "customerId": "v1:1292",
  "id": "v1:2706174"
}

Response

OK

versioninteger

The transaction version

taxAmountToCollectinteger

The total tax amount to collect from the customer, in the smallest denomination of the currency (e.g. cents or pennies).

preTaxAmountstring Decimal

The total pre-tax amount for the transaction, in the smallest denomination of the currency (e.g. cents or pennies).

taxComplianceMessagestring nullable

Notices required for invoices (e.g. reverse-charge notices, filing-amount disclosures, or VAT gross-up formulas) for non-US jurisdictions. Controlled by the API integration's tax compliance message configuration (on by default). Omitted for legacy API keys. When present, the value is a string if a message applies, or null if none applies.

Changes

No recorded changes to this operation across all 1 revision of this API.