vendasta/accounts

There is no license information available for the latest version (1.1.0) of this package.

Vendasta accounts library for PHP

1.1.0 2020-09-16 21:22 UTC

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

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