Module: AvaTax::Client::Transactions
- Included in:
- AvaTax::Client
- Defined in:
- lib/avatax/client/transactions.rb
Instance Method Summary collapse
-
#add_lines(model, options = {}) ⇒ Object
Add lines to an existing unlocked transaction.
-
#adjust_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Correct a previously created transaction.
-
#audit_transaction(companyCode, transactionCode) ⇒ Object
Get audit information about a transaction.
-
#audit_transaction_with_type(companyCode, transactionCode, documentType) ⇒ Object
Get audit information about a transaction.
-
#bulk_lock_transaction(model) ⇒ Object
Lock a set of documents.
-
#change_transaction_code(companyCode, transactionCode, model, options = {}) ⇒ Object
Change a transaction's code.
-
#commit_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Commit a transaction for reporting.
-
#create_or_adjust_transaction(model, options = {}) ⇒ Object
Create or adjust a transaction.
-
#create_transaction(model, options = {}) ⇒ Object
Create a new transaction.
-
#delete_lines(model, options = {}) ⇒ Object
Remove lines from an existing unlocked transaction.
-
#get_all_variance_report_by_company_code(companyCode) ⇒ Object
Fetches the Variance data generated for all the transactions done by Company.
-
#get_transaction_by_code(companyCode, transactionCode, options = {}) ⇒ Object
Retrieve a single transaction by code.
-
#get_transaction_by_code_and_type(companyCode, transactionCode, documentType, options = {}) ⇒ Object
Retrieve a single transaction by code.
-
#get_transaction_by_id(id, options = {}) ⇒ Object
Retrieve a single transaction by ID.
-
#get_variance_report_by_company_code_by_transaction_id(companyCode, transactionId) ⇒ Object
Fetches the Variance data generated for particular Company by transaction ID.
-
#list_transactions_by_company(companyCode, options = {}) ⇒ FetchResult
Retrieve all transactions.
-
#lock_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Lock a single transaction.
-
#refund_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Create a refund for a transaction.
-
#settle_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Perform multiple actions on a transaction.
-
#uncommit_transaction(companyCode, transactionCode, options = {}) ⇒ Object
Uncommit a transaction for reporting.
-
#unvoid_transaction(companyCode, transactionCode, options = {}) ⇒ Object
Unvoids a transaction.
-
#variance_report(companyCode, model) ⇒ Object
Generates the Variance report which will capture the difference between "Tax Calculated by Avalara" Vs "Actual Tax" paid at custom clearance at line / header level.
-
#verify_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Verify a transaction.
-
#void_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Void a transaction.
Instance Method Details
#add_lines(model, options = {}) ⇒ Object
Add lines to an existing unlocked transaction
Add lines to an existing unlocked transaction.
The AddLines
API allows you to add additional transaction lines to existing transaction, so that customer will
be able to append multiple calls together and form an extremely large transaction. If customer does not specify line number
in the lines to be added, a new random Guid string will be generated for line number. If customer are not satisfied with
the line number for the transaction lines, they can turn on the renumber switch to have REST v2 automatically renumber all
transaction lines for them, in this case, the line number becomes: "1", "2", "3", ...
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
If you omit the $include
parameter, the API will assume you want Summary,Addresses
.
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
38 39 |
# File 'lib/avatax/client/transactions.rb', line 38 def add_lines(model, ={}) path = "/api/v2/companies/transactions/lines/add" post(path, model, , AvaTax::VERSION) end |
#adjust_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Correct a previously created transaction
Replaces the current transaction uniquely identified by this URL with a new transaction.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
When you adjust a committed transaction, the original transaction will be updated with the status code Adjusted
, and
both revisions will be available for retrieval based on their code and ID numbers.
Only transactions in Committed
status are reported by Avalara Managed Returns.
Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered locked
and are
no longer available for adjustments.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
85 86 |
# File 'lib/avatax/client/transactions.rb', line 85 def adjust_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/adjust" post(path, model, , AvaTax::VERSION) end |
#audit_transaction(companyCode, transactionCode) ⇒ Object
Get audit information about a transaction
Retrieve audit information about a transaction stored in AvaTax.
The AuditTransaction
API retrieves audit information related to a specific transaction. This audit
information includes the following:
- The
CompanyId
of the company that created the transaction - The server timestamp representing the exact server time when the transaction was created
- The server duration - how long it took to process this transaction
- Whether exact API call details were logged
- A reconstructed API call showing what the original CreateTransaction call looked like
This API can be used to examine information about a previously created transaction.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
122 123 |
# File 'lib/avatax/client/transactions.rb', line 122 def audit_transaction(companyCode, transactionCode) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/audit" get(path, {}, AvaTax::VERSION) end |
#audit_transaction_with_type(companyCode, transactionCode, documentType) ⇒ Object
Get audit information about a transaction
Retrieve audit information about a transaction stored in AvaTax.
The AuditTransaction
API retrieves audit information related to a specific transaction. This audit
information includes the following:
- The
CompanyId
of the company that created the transaction - The server timestamp representing the exact server time when the transaction was created
- The server duration - how long it took to process this transaction
- Whether exact API call details were logged
- A reconstructed API call showing what the original CreateTransaction call looked like
This API can be used to examine information about a previously created transaction.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
160 161 |
# File 'lib/avatax/client/transactions.rb', line 160 def audit_transaction_with_type(companyCode, transactionCode, documentType) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/types/#{documentType}/audit" get(path, {}, AvaTax::VERSION) end |
#bulk_lock_transaction(model) ⇒ Object
Lock a set of documents
This API is available by invitation only.
Lock a set of transactions uniquely identified by DocumentIds provided. This API allows locking multiple documents at once. After this API call succeeds, documents will be locked and can't be voided.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
Security Policies
- This API requires the user role Compliance Root User.
- This API depends on the following active services:Returns (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.Firm Managed (for accounts managed by a firm): ARA, ARAManaged. Swagger Name: AvaTaxClient
180 181 |
# File 'lib/avatax/client/transactions.rb', line 180 def bulk_lock_transaction(model) path = "/api/v2/transactions/lock" post(path, model, {}, AvaTax::VERSION) end |
#change_transaction_code(companyCode, transactionCode, model, options = {}) ⇒ Object
Change a transaction's code
Renames a transaction uniquely identified by this URL by changing its code
value.
This API is available as long as the transaction is in saved
or posted
status. When a transaction
is committed
, it can be modified by using the AdjustTransaction method.
After this API call succeeds, the transaction will have a new URL matching its new code
.
If you have more than one document with the same code
, specify the documentType
parameter to choose between them.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
227 228 |
# File 'lib/avatax/client/transactions.rb', line 227 def change_transaction_code(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/changecode" post(path, model, , AvaTax::VERSION) end |
#commit_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Commit a transaction for reporting
Marks a transaction by changing its status to Committed
.
Transactions that are committed are available to be reported to a tax authority by Avalara Managed Returns.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
If you have more than one document with the same code
, specify the documentType
parameter to choose between them.
Any changes made to a committed transaction will generate a transaction history.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin. Swagger Name: AvaTaxClient
272 273 |
# File 'lib/avatax/client/transactions.rb', line 272 def commit_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/commit" post(path, model, , AvaTax::VERSION) end |
#create_or_adjust_transaction(model, options = {}) ⇒ Object
Create or adjust a transaction
Records a new transaction or adjust an existing transaction in AvaTax.
The CreateOrAdjustTransaction
endpoint is used to create a new transaction or update an existing one. This API
can help you create an idempotent service that creates transactions
If there exists a transaction identified by code, the original transaction will be adjusted by using the meta data
in the input transaction.
The CreateOrAdjustTransaction
API cannot modify any transaction that has been reported to a tax authority using
the Avalara Managed Returns Service or any other tax filing service. If you call this API to attempt to modify
a transaction that has been reported on a tax filing, you will receive the error CannotModifyLockedTransaction
.
To generate a refund for a transaction, use the RefundTransaction
API.
An address is required for calculation. If no address is provided at the line level, the document level address will be used.
If you don't specify the field type
in your request, you will get an estimate of type SalesOrder
, which will not be recorded in the database.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.
If you omit the $include
parameter, the API will assume you want Summary,Addresses
.
NOTE: Avoid using the following strings in your transaction codes as they are encoding strings and will be interpreted differently:
- _-ava2f-_
- _-ava2b-_
- _-ava3f-_
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
322 323 |
# File 'lib/avatax/client/transactions.rb', line 322 def create_or_adjust_transaction(model, ={}) path = "/api/v2/transactions/createoradjust" post(path, model, , AvaTax::VERSION) end |
#create_transaction(model, options = {}) ⇒ Object
Create a new transaction
Records a new transaction in AvaTax.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
The CreateTransaction
endpoint uses the tax profile of your company to identify the correct tax rules
and rates to apply to all line items in this transaction. The end result will be the total tax calculated by AvaTax based on your
company's configuration and the data provided in this API call.
The CreateTransaction
API will report an error if a committed transaction already exists with the same code
. To
avoid this error, use the CreateOrAdjustTransaction
API - it will create the transaction if it does not exist, or
update it if it does exist.
To generate a refund for a transaction, use the RefundTransaction
API.
An address is required for calculation. If no address is provided at the line level, the document level address will be used.
The field type
identifies the kind of transaction - for example, a sale, purchase, or refund. If you do not specify
a type
value, you will receive an estimate of type SalesOrder
, which will not be recorded.
The origin and destination locations for a transaction must be identified by either address or geocode. For address-based transactions, please
provide addresses in the fields line
, city
, region
, country
and postalCode
. For geocode-based transactions, please provide the geocode
information in the fields latitude
and longitude
. If either latitude
or longitude
or both are null, the transaction will be calculated
using the best available address location information.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
If you omit the $include
parameter, the API will assume you want Summary,Addresses
.
NOTE: Avoid using the following strings in your transaction codes as they are encoding strings and will be interpreted differently:
- _-ava2f-_
- _-ava2b-_
- _-ava3f-_
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
379 380 |
# File 'lib/avatax/client/transactions.rb', line 379 def create_transaction(model, ={}) path = "/api/v2/transactions/create" post(path, model, , AvaTax::VERSION) end |
#delete_lines(model, options = {}) ⇒ Object
Remove lines from an existing unlocked transaction
Remove lines to an existing unlocked transaction.
The DeleteLines
API allows you to remove transaction lines from existing unlocked transaction, so that customer will
be able to delete transaction lines and adjust original transaction the way they like
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
If you omit the $include
parameter, the API will assume you want Summary,Addresses
.
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
411 412 |
# File 'lib/avatax/client/transactions.rb', line 411 def delete_lines(model, ={}) path = "/api/v2/companies/transactions/lines/delete" post(path, model, , AvaTax::VERSION) end |
#get_all_variance_report_by_company_code(companyCode) ⇒ Object
Fetches the Variance data generated for all the transactions done by Company.
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
423 424 |
# File 'lib/avatax/client/transactions.rb', line 423 def get_all_variance_report_by_company_code(companyCode) path = "/api/v2/companies/#{companyCode}/AllVariance" get(path, {}, AvaTax::VERSION) end |
#get_transaction_by_code(companyCode, transactionCode, options = {}) ⇒ Object
Retrieve a single transaction by code
Get the current transaction identified by this company code, transaction code, and document type.
A transaction is uniquely identified by companyCode
, code
(often called Transaction Code), and documentType
.
For compatibility purposes, when this API finds multiple transactions with the same transaction code, and if you have not specified
the type
parameter to this API, it will default to selecting the SalesInvoices
transaction. To change this behavior, use the
optional documentType
parameter to specify the specific document type you wish to find.
If this transaction was adjusted, the return value of this API will be the current transaction with this code.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
466 467 |
# File 'lib/avatax/client/transactions.rb', line 466 def get_transaction_by_code(companyCode, transactionCode, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}" get(path, , AvaTax::VERSION) end |
#get_transaction_by_code_and_type(companyCode, transactionCode, documentType, options = {}) ⇒ Object
Retrieve a single transaction by code
DEPRECATED: Please use the GetTransactionByCode
API instead.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
491 492 |
# File 'lib/avatax/client/transactions.rb', line 491 def get_transaction_by_code_and_type(companyCode, transactionCode, documentType, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/types/#{documentType}" get(path, , AvaTax::VERSION) end |
#get_transaction_by_id(id, options = {}) ⇒ Object
Retrieve a single transaction by ID
Get the unique transaction identified by this URL.
This endpoint retrieves the exact transaction identified by this ID number, as long as it is the most version of the transaction.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
522 523 |
# File 'lib/avatax/client/transactions.rb', line 522 def get_transaction_by_id(id, ={}) path = "/api/v2/transactions/#{id}" get(path, , AvaTax::VERSION) end |
#get_variance_report_by_company_code_by_transaction_id(companyCode, transactionId) ⇒ Object
Fetches the Variance data generated for particular Company by transaction ID
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
535 536 |
# File 'lib/avatax/client/transactions.rb', line 535 def get_variance_report_by_company_code_by_transaction_id(companyCode, transactionId) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionId}/variance" get(path, {}, AvaTax::VERSION) end |
#list_transactions_by_company(companyCode, options = {}) ⇒ FetchResult
Retrieve all transactions
List all transactions attached to this company.
This endpoint is limited to returning 1,000 transactions at a time maximum.
When listing transactions, you must specify a date
range filter. If you do not specify a $filter
that includes a date
field
criteria, the query will default to looking at only those transactions with date
in the past 30 days.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
Search for specific objects using the criteria in the $filter
parameter; full documentation is available on Filtering in REST .
Paginate your results using the $top
, $skip
, and $orderby
parameters.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
584 585 |
# File 'lib/avatax/client/transactions.rb', line 584 def list_transactions_by_company(companyCode, ={}) path = "/api/v2/companies/#{companyCode}/transactions" get(path, , AvaTax::VERSION) end |
#lock_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Lock a single transaction
Lock a transaction uniquely identified by this URL.
This API is mainly used for connector developers to simulate what happens when the Returns product locks a document. After this API call succeeds, the document will be locked and can't be voided or adjusted.
On Sandbox, this API is only available to customers who have both an AvaTaxPro and a Managed Returns subscription. On Production, this API is only available internally for the Avalara Returns team.
If you have more than one document with the same code
, specify the documentType
parameter to choose between them.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Returns (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.Firm Managed (for accounts managed by a firm): ARA, ARAManaged. Swagger Name: AvaTaxClient
631 632 |
# File 'lib/avatax/client/transactions.rb', line 631 def lock_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/lock" post(path, model, , AvaTax::VERSION) end |
#refund_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Create a refund for a transaction
Create a refund for a transaction.
The RefundTransaction
API allows you to quickly and easily create a ReturnInvoice
representing a refund
for a previously created SalesInvoice
transaction. You can choose to create a full or partial refund, and
specify individual line items from the original sale for refund.
The RefundTransaction
API ensures that the tax amount you refund to the customer exactly matches the tax that
was calculated during the original transaction, regardless of any changes to your company's configuration, rules,
nexus, or any other setting.
This API is intended to be a shortcut to allow you to quickly and accurately generate a refund for the following common refund scenarios:
- A full refund of a previous sale
- Refunding the tax that was charged on a previous sale, when the customer provides an exemption certificate after the purchase
- Refunding one or more items (lines) from a previous sale
- Granting a customer a percentage refund of a previous sale
For more complex scenarios than the ones above, please use CreateTransaction
with document type ReturnInvoice
to
create a custom refund transaction.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
If you omit the
$include
parameter, the API will assume you wantSummary,Addresses
.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
689 690 |
# File 'lib/avatax/client/transactions.rb', line 689 def refund_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/refund" post(path, model, , AvaTax::VERSION) end |
#settle_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Perform multiple actions on a transaction
Performs one or more actions against the current transaction uniquely identified by this URL.
The SettleTransaction
API call can perform the work of ChangeCode
, VerifyTransaction
, and CommitTransaction
.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
If you have more than one document with the same code
, specify the documentType
parameter to choose between them.
This API is available for users who want to execute more than one action at a time.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin. Swagger Name: AvaTaxClient
734 735 |
# File 'lib/avatax/client/transactions.rb', line 734 def settle_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/settle" post(path, model, , AvaTax::VERSION) end |
#uncommit_transaction(companyCode, transactionCode, options = {}) ⇒ Object
Uncommit a transaction for reporting
Adjusts a transaction by changing it to an uncommitted status.
Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered locked
and are
no longer available to be uncommitted.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
773 774 |
# File 'lib/avatax/client/transactions.rb', line 773 def uncommit_transaction(companyCode, transactionCode, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/uncommit" post(path, {}, , AvaTax::VERSION) end |
#unvoid_transaction(companyCode, transactionCode, options = {}) ⇒ Object
Unvoids a transaction
Unvoids a voided transaction
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
809 810 |
# File 'lib/avatax/client/transactions.rb', line 809 def unvoid_transaction(companyCode, transactionCode, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/unvoid" post(path, {}, , AvaTax::VERSION) end |
#variance_report(companyCode, model) ⇒ Object
Generates the Variance report which will capture the difference between "Tax Calculated by Avalara" Vs "Actual Tax" paid at custom clearance at line / header level.
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
822 823 |
# File 'lib/avatax/client/transactions.rb', line 822 def variance_report(companyCode, model) path = "/api/v2/companies/#{companyCode}/variance" post(path, model, {}, AvaTax::VERSION) end |
#verify_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Verify a transaction
Verifies that the transaction uniquely identified by this URL matches certain expected values.
If the transaction does not match these expected values, this API will return an error code indicating which value did not match.
If you have more than one document with the same code
, specify the documentType
parameter to choose between them.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
866 867 |
# File 'lib/avatax/client/transactions.rb', line 866 def verify_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/verify" post(path, model, , AvaTax::VERSION) end |
#void_transaction(companyCode, transactionCode, model, options = {}) ⇒ Object
Void a transaction
Voids the current transaction uniquely identified by this URL.
A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).
When you void a transaction, that transaction's status is recorded as DocVoided
.
If you have more than one document with the same code
, specify the documentType
parameter to choose between them.
Transactions that have been previously reported to a tax authority by Avalara Managed Returns are no longer available to be voided.
You may specify one or more of the following values in the $include
parameter to fetch additional nested data, using commas to separate multiple values:
- Lines
- Details (implies lines)
- AccountPayableSalesTaxDetails (implies lines - only for Account Payable transaction)
- Summary (implies details)
- Addresses
- SummaryOnly (omit lines and details - reduces API response size)
- LinesOnly (omit details - reduces API response size)
- TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
- Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
- Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
- Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
- Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
- Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
- Replace ' ' with '%20' For example: document Code becomes document%20Code
Security Policies
- This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
- This API depends on the following active services:Required (all): AvaTaxPro, BasicReturns. Swagger Name: AvaTaxClient
912 913 |
# File 'lib/avatax/client/transactions.rb', line 912 def void_transaction(companyCode, transactionCode, model, ={}) path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/void" post(path, model, , AvaTax::VERSION) end |