avalara/avalara_sdk
最新稳定版本:25.11.2
Composer 安装命令:
composer require avalara/avalara_sdk
包简介
API for evaluating transactions against direct-to-consumer Beverage Alcohol shipping regulations. This API is currently in beta.
README 文档
README
Unified SDK consists of services on top of which the Avalara Compliance Cloud platform is built. These services are foundational and provide functionality such as einvoicing.
Installation & Usage
Requirements
PHP 7.3 and later. Should also work with PHP 8.0 but has not been tested.
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/avadev/Avalara-SDK-PHP.git"
}
],
"require": {
"avalara/avalara_sdk": "24.12.1"
}
}
Then run composer install
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure HTTP OAUTH2 Access Token and other config options $config = new \Avalara\SDK\Configuration(); $config->setBearerToken('YOUR_JWT_ACCESS_TOKEN'); $config->setAppName('YOUR_APP_NAME'); $config->setEnvironment('sandbox'); $config->setMachineName('YOUR_MACHINE_NAME'); $config->setAppVersion('YOUR_APP_VERSION'); $client = new \Avalara\SDK\ApiClient($config); $apiInstance = new \Avalara\SDK\API\EInvoicing\V1\MandatesApi($client); $request_options = new \Avalara\SDK\API\EInvoicing\V1\GetMandatesRequest(); $request_options->setXAvalaraClient('Swagger UI; 22.7.0; Custom; 1.0'); // string | Identifies the software you are using to call this API. For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) . try { $result = $apiInstance->getMandates($request_options); print_r("Result: ". $result); } catch (Exception $e) { echo 'Exception when calling AddressesApi->resolveAddressPost: ', $e->getMessage(), PHP_EOL; }
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Logging
All PSR-3 compatible loggers are supported by the SDK.
Usage
Declare whichever PSR-3 logger that you desire and pass it in via the configuration object. The example below uses Monolog
use Monolog\Logger; use Monolog\Handler\StreamHandler; $config = new \Avalara\SDK\Configuration(); // Configure logger $logger = new Logger('AddressLogger'); $logger->pushHandler(new StreamHandler(__DIR__ . '/../../app.log', Logger::DEBUG)); // Setup log options , first parameter is logRequestAndResponseBody, which can be true|false. Second parameter is the PSR-3 compatible logger. $logOptions = new \Avalara\SDK\Utils\LogOptions(true, $logger); $config->setLogOptions($logOptions); $client = new \Avalara\SDK\ApiClient($config);
Documentation for API Endpoints
EInvoicing V1 API Documentation
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DataInputFieldsApi | getDataInputFields | GET /data-input-fields | Returns the optionality of document fields for different country mandates |
| DocumentsApi | downloadDocument | GET /documents/{documentId}/$download | Returns a copy of the document |
| DocumentsApi | fetchDocuments | POST /documents/$fetch | Fetch the inbound document from a tax authority |
| DocumentsApi | getDocumentList | GET /documents | Returns a summary of documents for a date range |
| DocumentsApi | getDocumentStatus | GET /documents/{documentId}/status | Checks the status of a document |
| DocumentsApi | submitDocument | POST /documents | Submits a document to Avalara E-Invoicing API |
| InteropApi | submitInteropDocument | POST /interop/documents | Submit a document |
| MandatesApi | getMandateDataInputFields | GET /mandates/{mandateId}/data-input-fields | Returns document field information for a country mandate, a selected document type, and its version |
| MandatesApi | getMandates | GET /mandates | List country mandates that are supported by the Avalara E-Invoicing platform |
| TradingPartnersApi | batchSearchParticipants | POST /trading-partners/batch-searches | Creates a batch search and performs a batch search in the directory for participants in the background. |
| TradingPartnersApi | downloadBatchSearchReport | GET /trading-partners/batch-searches/{id}/$download-results | Download batch search results in a csv file. |
| TradingPartnersApi | getBatchSearchDetail | GET /trading-partners/batch-searches/{id} | Get the batch search details for a given id. |
| TradingPartnersApi | listBatchSearches | GET /trading-partners/batch-searches | List all batch searches that were previously submitted. |
| TradingPartnersApi | searchParticipants | GET /trading-partners | Returns a list of participants matching the input query. |
Documentation for Models
EInvoicing V1 Model Documentation
- Avalara\SDK\Model\EInvoicing\V1\BadDownloadRequest
- Avalara\SDK\Model\EInvoicing\V1\BadRequest
- Avalara\SDK\Model\EInvoicing\V1\BatchSearch
- Avalara\SDK\Model\EInvoicing\V1\BatchSearchListResponse
- Avalara\SDK\Model\EInvoicing\V1\ConditionalForField
- Avalara\SDK\Model\EInvoicing\V1\DataInputField
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldNotUsedFor
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldOptionalFor
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldRequiredFor
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldsResponse
- Avalara\SDK\Model\EInvoicing\V1\DirectorySearchResponse
- Avalara\SDK\Model\EInvoicing\V1\DirectorySearchResponseValueInner
- Avalara\SDK\Model\EInvoicing\V1\DirectorySearchResponseValueInnerAddressesInner
- Avalara\SDK\Model\EInvoicing\V1\DirectorySearchResponseValueInnerIdentifiersInner
- Avalara\SDK\Model\EInvoicing\V1\DirectorySearchResponseValueInnerSupportedDocumentTypesInner
- Avalara\SDK\Model\EInvoicing\V1\DocumentFetch
- Avalara\SDK\Model\EInvoicing\V1\DocumentFetchRequest
- Avalara\SDK\Model\EInvoicing\V1\DocumentFetchRequestDataInner
- Avalara\SDK\Model\EInvoicing\V1\DocumentFetchRequestMetadata
- Avalara\SDK\Model\EInvoicing\V1\DocumentListResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentStatusResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentSubmissionError
- Avalara\SDK\Model\EInvoicing\V1\DocumentSubmitResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentSummary
- Avalara\SDK\Model\EInvoicing\V1\ErrorResponse
- Avalara\SDK\Model\EInvoicing\V1\ForbiddenError
- Avalara\SDK\Model\EInvoicing\V1\InputDataFormats
- Avalara\SDK\Model\EInvoicing\V1\InternalServerError
- Avalara\SDK\Model\EInvoicing\V1\Mandate
- Avalara\SDK\Model\EInvoicing\V1\MandateDataInputField
- Avalara\SDK\Model\EInvoicing\V1\MandateDataInputFieldNamespace
- Avalara\SDK\Model\EInvoicing\V1\MandatesResponse
- Avalara\SDK\Model\EInvoicing\V1\NotFoundError
- Avalara\SDK\Model\EInvoicing\V1\NotUsedForField
- Avalara\SDK\Model\EInvoicing\V1\RequiredWhenField
- Avalara\SDK\Model\EInvoicing\V1\StatusEvent
- Avalara\SDK\Model\EInvoicing\V1\SubmitDocumentMetadata
- Avalara\SDK\Model\EInvoicing\V1\SubmitInteropDocument202Response
- Avalara\SDK\Model\EInvoicing\V1\WorkflowIds
Documentation for API Endpoints
EInvoicing V1 API Documentation
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DataInputFieldsApi | getDataInputFields | GET /data-input-fields | Returns the optionality of document fields for different country mandates |
| DocumentsApi | downloadDocument | GET /documents/{documentId}/$download | Returns a copy of the document |
| DocumentsApi | fetchDocuments | POST /documents/$fetch | Fetch the inbound document from a tax authority |
| DocumentsApi | getDocumentList | GET /documents | Returns a summary of documents for a date range |
| DocumentsApi | getDocumentStatus | GET /documents/{documentId}/status | Checks the status of a document |
| DocumentsApi | submitDocument | POST /documents | Submits a document to Avalara E-Invoicing API |
| InteropApi | submitInteropDocument | POST /interop/documents | Submit a document |
| MandatesApi | getMandateDataInputFields | GET /mandates/{mandateId}/data-input-fields | Returns document field information for a country mandate, a selected document type, and its version |
| MandatesApi | getMandates | GET /mandates | List country mandates that are supported by the Avalara E-Invoicing platform |
| SubscriptionsApi | createWebhookSubscription | POST /webhooks/subscriptions | Create a subscription to events |
| SubscriptionsApi | deleteWebhookSubscription | DELETE /webhooks/subscriptions/{subscription-id} | Unsubscribe from events |
| SubscriptionsApi | getWebhookSubscription | GET /webhooks/subscriptions/{subscription-id} | Get details of a subscription |
| SubscriptionsApi | listWebhookSubscriptions | GET /webhooks/subscriptions | List all subscriptions |
| TaxIdentifiersApi | taxIdentifierSchemaByCountry | GET /tax-identifiers/schema | Returns the tax identifier request & response schema for a specific country. |
| TaxIdentifiersApi | validateTaxIdentifier | POST /tax-identifiers/validate | Validates a tax identifier. |
| TradingPartnersApi | batchSearchParticipants | POST /trading-partners/batch-searches | Handles batch search requests by uploading a file containing search parameters. |
| TradingPartnersApi | createTradingPartner | POST /trading-partners | Creates a new trading partner. |
| TradingPartnersApi | createTradingPartnersBatch | POST /trading-partners/batch | Creates a batch of multiple trading partners. |
| TradingPartnersApi | deleteTradingPartner | DELETE /trading-partners/{id} | Deletes a trading partner using ID. |
| TradingPartnersApi | downloadBatchSearchReport | GET /trading-partners/batch-searches/{id}/$download-results | Downloads batch search results in a csv file. |
| TradingPartnersApi | getBatchSearchDetail | GET /trading-partners/batch-searches/{id} | Returns the batch search details using ID. |
| TradingPartnersApi | listBatchSearches | GET /trading-partners/batch-searches | Lists all batch searches that were previously submitted. |
| TradingPartnersApi | searchParticipants | GET /trading-partners | Returns a list of participants matching the input query. |
| TradingPartnersApi | updateTradingPartner | PUT /trading-partners/{id} | Updates a trading partner using ID. |
A1099 V2 API Documentation
| Class | Method | HTTP request | Description |
|---|---|---|---|
| CompaniesW9Api | createCompany | POST /w9/companies | Create a company |
| CompaniesW9Api | deleteCompany | DELETE /w9/companies/{id} | Delete a company |
| CompaniesW9Api | getCompanies | GET /w9/companies | List companies |
| CompaniesW9Api | getCompany | GET /w9/companies/{id} | Retrieve a company |
| CompaniesW9Api | updateCompany | PUT /w9/companies/{id} | Update a company |
| Forms1099Api | bulkUpsert1099Forms | POST /1099/forms/$bulk-upsert | Create or update multiple 1099/1095/W2/1042S forms |
| Forms1099Api | create1099Form | POST /1099/forms | Create a 1099/1095/W2/1042S form |
| Forms1099Api | delete1099Form | DELETE /1099/forms/{id} | Delete a 1099/1095/W2/1042S form |
| Forms1099Api | get1099Form | GET /1099/forms/{id} | Retrieve a 1099/1095/W2/1042S form |
| Forms1099Api | get1099FormPdf | GET /1099/forms/{id}/pdf | Retrieve the PDF file for a 1099/1095/W2/1042S form |
| Forms1099Api | list1099Forms | GET /1099/forms | List 1099/1095/W2/1042S forms |
| Forms1099Api | update1099Form | PUT /1099/forms/{id} | Update a 1099/1095/W2/1042S form |
| FormsW9Api | createAndSendW9FormEmail | POST /w9/forms/$create-and-send-email | Create a minimal W9/W4/W8 form and sends the e-mail request |
| FormsW9Api | createW9Form | POST /w9/forms | Create a W9/W4/W8 form |
| FormsW9Api | deleteW9Form | DELETE /w9/forms/{id} | Delete a W9/W4/W8 form |
| FormsW9Api | getW9Form | GET /w9/forms/{id} | Retrieve a W9/W4/W8 form |
| FormsW9Api | getW9FormPdf | GET /w9/forms/{id}/pdf | Download the PDF for a W9/W4/W8 form. |
| FormsW9Api | listW9Forms | GET /w9/forms | List W9/W4/W8 forms |
| FormsW9Api | sendW9FormEmail | POST /w9/forms/{id}/$send-email | Send an email to the vendor/payee requesting they fill out a W9/W4/W8 form |
| FormsW9Api | updateW9Form | PUT /w9/forms/{id} | Update a W9/W4/W8 form |
| FormsW9Api | uploadW9Files | POST /w9/forms/{id}/attachment | Replace the PDF file for a W9/W4/W8 form |
| Issuers1099Api | createIssuer | POST /1099/issuers | Create an issuer |
| Issuers1099Api | deleteIssuer | DELETE /1099/issuers/{id} | Delete an issuer |
| Issuers1099Api | getIssuer | GET /1099/issuers/{id} | Retrieve an issuer |
| Issuers1099Api | getIssuers | GET /1099/issuers | List issuers |
| Issuers1099Api | updateIssuer | PUT /1099/issuers/{id} | Update an issuer |
| JobsApi | getJob | GET /jobs/{id} | Retrieves information about the job |
Documentation for Models
EInvoicing V1 Model Documentation
- Avalara\SDK\Model\EInvoicing\V1\Address
- Avalara\SDK\Model\EInvoicing\V1\BadDownloadRequest
- Avalara\SDK\Model\EInvoicing\V1\BadRequest
- Avalara\SDK\Model\EInvoicing\V1\BatchErrorDetail
- Avalara\SDK\Model\EInvoicing\V1\BatchSearch
- Avalara\SDK\Model\EInvoicing\V1\BatchSearchListResponse
- Avalara\SDK\Model\EInvoicing\V1\BatchSearchParticipants202Response
- Avalara\SDK\Model\EInvoicing\V1\ConditionalForField
- Avalara\SDK\Model\EInvoicing\V1\Consents
- Avalara\SDK\Model\EInvoicing\V1\CreateTradingPartner201Response
- Avalara\SDK\Model\EInvoicing\V1\CreateTradingPartnersBatch200Response
- Avalara\SDK\Model\EInvoicing\V1\CreateTradingPartnersBatch200ResponseValueInner
- Avalara\SDK\Model\EInvoicing\V1\CreateTradingPartnersBatchRequest
- Avalara\SDK\Model\EInvoicing\V1\DataInputField
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldNotUsedFor
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldOptionalFor
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldRequiredFor
- Avalara\SDK\Model\EInvoicing\V1\DataInputFieldsResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentFetch
- Avalara\SDK\Model\EInvoicing\V1\DocumentListResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentStatusResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentSubmissionError
- Avalara\SDK\Model\EInvoicing\V1\DocumentSubmitResponse
- Avalara\SDK\Model\EInvoicing\V1\DocumentSummary
- Avalara\SDK\Model\EInvoicing\V1\ErrorResponse
- Avalara\SDK\Model\EInvoicing\V1\EventId
- Avalara\SDK\Model\EInvoicing\V1\EventMessage
- Avalara\SDK\Model\EInvoicing\V1\EventPayload
- Avalara\SDK\Model\EInvoicing\V1\EventSubscription
- Avalara\SDK\Model\EInvoicing\V1\Extension
- Avalara\SDK\Model\EInvoicing\V1\FetchDocumentsRequest
- Avalara\SDK\Model\EInvoicing\V1\FetchDocumentsRequestDataInner
- Avalara\SDK\Model\EInvoicing\V1\FetchDocumentsRequestMetadata
- Avalara\SDK\Model\EInvoicing\V1\ForbiddenError
- Avalara\SDK\Model\EInvoicing\V1\HmacSignature
- Avalara\SDK\Model\EInvoicing\V1\HmacSignatureValue
- Avalara\SDK\Model\EInvoicing\V1\Id
- Avalara\SDK\Model\EInvoicing\V1\Identifier
- Avalara\SDK\Model\EInvoicing\V1\InputDataFormats
- Avalara\SDK\Model\EInvoicing\V1\InternalServerError
- Avalara\SDK\Model\EInvoicing\V1\Mandate
- Avalara\SDK\Model\EInvoicing\V1\MandateDataInputField
- Avalara\SDK\Model\EInvoicing\V1\MandateDataInputFieldNamespace
- Avalara\SDK\Model\EInvoicing\V1\MandatesResponse
- Avalara\SDK\Model\EInvoicing\V1\NotFoundError
- Avalara\SDK\Model\EInvoicing\V1\NotUsedForField
- Avalara\SDK\Model\EInvoicing\V1\OutputDataFormats
- Avalara\SDK\Model\EInvoicing\V1\Pagination
- Avalara\SDK\Model\EInvoicing\V1\RequiredWhenField
- Avalara\SDK\Model\EInvoicing\V1\SearchParticipants200Response
- Avalara\SDK\Model\EInvoicing\V1\Signature
- Avalara\SDK\Model\EInvoicing\V1\SignatureSignature
- Avalara\SDK\Model\EInvoicing\V1\SignatureValue
- Avalara\SDK\Model\EInvoicing\V1\SignatureValueSignature
- Avalara\SDK\Model\EInvoicing\V1\StatusEvent
- Avalara\SDK\Model\EInvoicing\V1\SubmitDocumentMetadata
- Avalara\SDK\Model\EInvoicing\V1\SubmitInteropDocument202Response
- Avalara\SDK\Model\EInvoicing\V1\SubscriptionCommon
- Avalara\SDK\Model\EInvoicing\V1\SubscriptionDetail
- Avalara\SDK\Model\EInvoicing\V1\SubscriptionListResponse
- Avalara\SDK\Model\EInvoicing\V1\SubscriptionRegistration
- Avalara\SDK\Model\EInvoicing\V1\SuccessResponse
- Avalara\SDK\Model\EInvoicing\V1\SupportedDocumentTypes
- Avalara\SDK\Model\EInvoicing\V1\TaxIdentifierRequest
- Avalara\SDK\Model\EInvoicing\V1\TaxIdentifierResponse
- Avalara\SDK\Model\EInvoicing\V1\TaxIdentifierResponseValue
- Avalara\SDK\Model\EInvoicing\V1\TaxIdentifierSchemaByCountry200Response
- Avalara\SDK\Model\EInvoicing\V1\TradingPartner
- Avalara\SDK\Model\EInvoicing\V1\UpdateTradingPartner200Response
- Avalara\SDK\Model\EInvoicing\V1\ValidationError
- Avalara\SDK\Model\EInvoicing\V1\WebhookInvocation
- Avalara\SDK\Model\EInvoicing\V1\WebhooksErrorInfo
- Avalara\SDK\Model\EInvoicing\V1\WebhooksErrorResponse
- Avalara\SDK\Model\EInvoicing\V1\WorkflowIds
A1099 V2 Model Documentation
- Avalara\SDK\Model\A1099\V2\CompanyBase
- Avalara\SDK\Model\A1099\V2\CompanyRequest
- Avalara\SDK\Model\A1099\V2\CompanyResponse
- Avalara\SDK\Model\A1099\V2\CoveredIndividual
- Avalara\SDK\Model\A1099\V2\CreateAndSendW9FormEmailRequest
- Avalara\SDK\Model\A1099\V2\CreateW9Form201Response
- Avalara\SDK\Model\A1099\V2\CreateW9FormRequest
- Avalara\SDK\Model\A1099\V2\EntryStatusResponse
- Avalara\SDK\Model\A1099\V2\ErrorResponse
- Avalara\SDK\Model\A1099\V2\ErrorResponseItem
- Avalara\SDK\Model\A1099\V2\Form1042S
- Avalara\SDK\Model\A1099\V2\Form1095B
- Avalara\SDK\Model\A1099\V2\Form1095C
- Avalara\SDK\Model\A1099\V2\Form1099Base
- Avalara\SDK\Model\A1099\V2\Form1099Div
- Avalara\SDK\Model\A1099\V2\Form1099Int
- Avalara\SDK\Model\A1099\V2\Form1099K
- Avalara\SDK\Model\A1099\V2\Form1099ListRequest
- Avalara\SDK\Model\A1099\V2\Form1099Misc
- Avalara\SDK\Model\A1099\V2\Form1099Nec
- Avalara\SDK\Model\A1099\V2\Form1099R
- Avalara\SDK\Model\A1099\V2\Form1099StatusDetail
- Avalara\SDK\Model\A1099\V2\Get1099Form200Response
- Avalara\SDK\Model\A1099\V2\IntermediaryOrFlowThrough
- Avalara\SDK\Model\A1099\V2\IrsResponse
- Avalara\SDK\Model\A1099\V2\IssuerBase
- Avalara\SDK\Model\A1099\V2\IssuerRequest
- Avalara\SDK\Model\A1099\V2\IssuerResponse
- Avalara\SDK\Model\A1099\V2\JobResponse
- Avalara\SDK\Model\A1099\V2\OfferAndCoverage
- Avalara\SDK\Model\A1099\V2\PaginatedQueryResultModelCompanyResponse
- Avalara\SDK\Model\A1099\V2\PaginatedQueryResultModelForm1099Base
- Avalara\SDK\Model\A1099\V2\PaginatedQueryResultModelIssuerResponse
- Avalara\SDK\Model\A1099\V2\PaginatedQueryResultModelW9FormBaseResponse
- Avalara\SDK\Model\A1099\V2\PrimaryWithholdingAgent
- Avalara\SDK\Model\A1099\V2\StateAndLocalWithholding
- Avalara\SDK\Model\A1099\V2\StateEfileStatusDetail
- Avalara\SDK\Model\A1099\V2\SubstantialUsOwnerRequest
- Avalara\SDK\Model\A1099\V2\SubstantialUsOwnerResponse
- Avalara\SDK\Model\A1099\V2\TinMatchStatusResponse
- Avalara\SDK\Model\A1099\V2\ValidationError
- Avalara\SDK\Model\A1099\V2\W4FormMinimalRequest
- Avalara\SDK\Model\A1099\V2\W4FormRequest
- Avalara\SDK\Model\A1099\V2\W4FormResponse
- Avalara\SDK\Model\A1099\V2\W8BenEFormMinimalRequest
- Avalara\SDK\Model\A1099\V2\W8BenEFormRequest
- Avalara\SDK\Model\A1099\V2\W8BenEFormResponse
- Avalara\SDK\Model\A1099\V2\W8BenFormMinimalRequest
- Avalara\SDK\Model\A1099\V2\W8BenFormRequest
- Avalara\SDK\Model\A1099\V2\W8BenFormResponse
- Avalara\SDK\Model\A1099\V2\W8ImyFormMinimalRequest
- Avalara\SDK\Model\A1099\V2\W8ImyFormRequest
- Avalara\SDK\Model\A1099\V2\W8ImyFormResponse
- Avalara\SDK\Model\A1099\V2\W9FormBaseMinimalRequest
- Avalara\SDK\Model\A1099\V2\W9FormBaseRequest
- Avalara\SDK\Model\A1099\V2\W9FormBaseResponse
- Avalara\SDK\Model\A1099\V2\W9FormMinimalRequest
- Avalara\SDK\Model\A1099\V2\W9FormRequest
- Avalara\SDK\Model\A1099\V2\W9FormResponse
统计信息
- 总下载量: 92
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: unlicense
- 更新时间: 2024-03-21