The Veem PHP SDK provides an interface to make it easier to call Veem Global Payments APIs.
- Latest SDK Version:
1.0.0
- Latest supported API Endpoint Version:
v1.1
- The SDK works on PHP 7 and beyond.
- A developer account
- An application with a customer account and the associated client id and secret (Authorization flow / Client Credentials flow)
- composer install with command:
composer require veem/sdk
- Start to Use Veem SDK classes in your PHP project
To test the code locally, follow the steps below:
- cd to the project directory
- Client can either integrate with Authorization flow or Client Credential Flow;
- For Authorization flow, create a VeemContext object, fill in the
clientId
,clientSecret
,authorizationCode
, andredirectUrl
(optional). - For Client Credentials flow, create a VeemContext object, fill in the
clientId
, andclientSecret
. - To exercise all Veem Global Payment APIs, pass the VeemContext object as constructor argument to VeemClient and calling access token methods for scenario of step 3 or step 4.
In order to get the access tokens from the Developer Portal;
Sign In with Veem - Sign into developer Portal .
Create an Application- Create a new application by providing the Name
, OAuth2 Redirection URLs
and Payment Status Webhooks
.
Create a Customer- Create a new customer by providing Business Name
, Country
and Primary Email
Get Credentials- Go the Application and select the Customer
and copy the Access Token
.
In order to get the access token
programmatically, get the client id, client secrets (Optional redirect url for Authorization flow).
use Veem\VeemContext;
use Veem\clients\VeemClient;
$context = new VeemContext("Test-46ecbf0b", "34b20dcf-6e6c-4bd4-83c3-159d5b7c3c27");
$veem = new VeemClient($context, $loginFromClientCredentials = true);
// or
$veem = new VeemClient($context);
$veem->getTokenFromClientCredentials();
The following example is to send invoice using Invoice Client
use Veem\VeemContext;
use Veem\clients\VeemClient;
// define a VeemClient Context Manager and auto login.
$context = new VeemContext("Test-46ecbf0b", "34b20dcf-6e6c-4bd4-83c3-159d5b7c3c27");
$veem = new VeemClient($context, $loginFromClientCredentials = true);
// define an InvoiceRequest
$account = new Account();
$account->setType('Business')
->setEmail('devsupport+gbp@veem.com')
->setFirstName('Wei')
->setLastName('Chen')
->setBusinessName('GBP Veem Wei')
->setCountryCode('GB')
->setPhoneCountryCode('44')
->setPhone('03700100222');
$amount = new Amount($number = 50, $currency = 'GBP');
$invoiceRequest = new Invoice();
$invoiceRequest->setAmount($amount)->setPayer($account);
// create an invoice
$invoice = $veem->getInvoiceClient()->create($invoiceRequest);
More Examples can be found under examples folder