vendasta / accounts
Vendasta accounts library for PHP
Requires
- google/common-protos: ^1.1
- google/protobuf: ^3.9.2
- grpc/grpc: ^v1.1.0
- guzzlehttp/guzzle: ^6.3
- mdanter/ecc: ^0.5.0
- vendasta/vax: ^1.2.0
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-11-15 05:01:33 UTC
README
Accounts php sdk
Description
This is Vendasta's official PHP SDK for API integration of accounts. This is used to provision apps for a business.
Requirements
- PHP 5.5 and above or PHP 7.0 and above
- PECL (may be used to install the required PHP extensions)
- Composer
- PHP gmp extension
- OPTIONAL (but recommended): PHP grpc extension
Installation
Install the requirements from above, then:
composer require vendasta/accounts-php-sdk
Authentication
To authenticate your SDK calls, you must provision a service account from within the Vendasta platform.
This feature is currently in alpha, therefore your service account credentials file will be provided to you manually.
You must put this file on your server, and set an environment variable to it's path:
export VENDASTA_APPLICATION_CREDENTIALS=<path to credentials.json>
Client Initialization
It is highly recommended that you use a singleton client instance. Each client initilization will open it's own connection, therefore using a singleton results in reusing a connection, saving time and resources.
To instantiate the client:
$environment = "DEMO"; // "PROD" for production environment $client = new Vendasta\Accounts\V1\AccountsServiceClient($environment);
App provisioning
To provision an App
$createReq = new Vendasta\Accounts\V1\ActivateAppRequest(); $createReq->setBusinessId(<business_id>); $createReq->setAppId("<app_id>"); $createReq->setPartnerId("<partner_id>"); $createReq->setEditionId("<edition_id>"); $resp = $client->ActivateApp($createReq);