Skip to content

velopaymentsapi/velo-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP client for Velo

License npm version CircleCI\

This library provides a PHP client that simplifies interactions with the Velo Payments API. For full details covering the API visit our docs at Velo Payments APIs. Note: some of the Velo API calls which require authorization via an access token, see the full docs on how to configure. Throughout this document and the Velo platform the following terms are used:

  • Payor. An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout.
  • Payee. The recipient of funds paid out by a payor.
  • Payment. A single transfer of funds from a payor to a payee.
  • Payout. A batch of Payments, typically used by a payor to logically group payments (e.g. by business day). Technically there need be no relationship between the payments in a payout - a single payout can contain payments to multiple payees and/or multiple payments to a single payee.
  • Sandbox. An integration environment provided by Velo Payments which offers a similar API experience to the production environment, but all funding and payment events are simulated, along with many other services such as OFAC sanctions list checking.

Overview

The Velo Payments API allows a payor to perform a number of operations. The following is a list of the main capabilities in a natural order of execution:

  • Authenticate with the Velo platform
  • Maintain a collection of payees
  • Query the payor’s current balance of funds within the platform and perform additional funding
  • Issue payments to payees
  • Query the platform for a history of those payments

This document describes the main concepts and APIs required to get up and running with the Velo Payments platform. It is not an exhaustive API reference. For that, please see the separate Velo Payments API Reference.

API Considerations

The Velo Payments API is REST based and uses the JSON format for requests and responses.

Most calls are secured using OAuth 2 security and require a valid authentication access token for successful operation. See the Authentication section for details.

Where a dynamic value is required in the examples below, the {token} format is used, suggesting that the caller needs to supply the appropriate value of the token in question (without including the { or } characters).

Where curl examples are given, the –d @filename.json approach is used, indicating that the request body should be placed into a file named filename.json in the current directory. Each of the curl examples in this document should be considered a single line on the command-line, regardless of how they appear in print.

Authenticating with the Velo Platform

Once Velo backoffice staff have added your organization as a payor within the Velo platform sandbox, they will create you a payor Id, an API key and an API secret and share these with you in a secure manner.

You will need to use these values to authenticate with the Velo platform in order to gain access to the APIs. The steps to take are explained in the following:

create a string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529

base64 encode this string. E.g.: NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==

create an HTTP Authorization header with the value set to e.g. Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==

perform the Velo authentication REST call using the HTTP header created above e.g. via curl:

  curl -X POST \\
  -H \"Content-Type: application/json\" \\
  -H \"Authorization: Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==\" \\
  'https://api.sandbox.velopayments.com/v1/authenticate?grant_type=client_credentials'

If successful, this call will result in a 200 HTTP status code and a response body such as:

  {
    \"access_token\":\"19f6bafd-93fd-4747-b229-00507bbc991f\",
    \"token_type\":\"bearer\",
    \"expires_in\":1799,
    \"scope\":\"...\"
  }

API access following authentication

Following successful authentication, the value of the access_token field in the response (indicated in green above) should then be presented with all subsequent API calls to allow the Velo platform to validate that the caller is authenticated.

This is achieved by setting the HTTP Authorization header with the value set to e.g. Bearer 19f6bafd-93fd-4747-b229-00507bbc991f such as the curl example below:

  -H \"Authorization: Bearer 19f6bafd-93fd-4747-b229-00507bbc991f \"

If you make other Velo API calls which require authorization but the Authorization header is missing or invalid then you will get a 401 HTTP status response.

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/velopaymentsapi/velo-php.git"
    }
  ],
  "require": {
    "velopaymentsapi/velo-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/VeloPayments/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure OAuth2 access token for authorization: OAuth2
$config = VeloPayments\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new VeloPayments\Client\Api\CountriesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->listPaymentChannelRulesV1();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CountriesApi->listPaymentChannelRulesV1: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://api.sandbox.velopayments.com

Class Method HTTP request Description
CountriesApi listPaymentChannelRulesV1 GET /v1/paymentChannelRules List Payment Channel Country Rules
CountriesApi listSupportedCountriesV1 GET /v1/supportedCountries List Supported Countries
CountriesApi listSupportedCountriesV2 GET /v2/supportedCountries List Supported Countries
CurrenciesApi listSupportedCurrenciesV2 GET /v2/currencies List Supported Currencies
FundingManagerApi createAchFundingRequest POST /v1/sourceAccounts/{sourceAccountId}/achFundingRequest Create Funding Request
FundingManagerApi createFundingRequest POST /v2/sourceAccounts/{sourceAccountId}/fundingRequest Create Funding Request
FundingManagerApi createFundingRequestV3 POST /v3/sourceAccounts/{sourceAccountId}/fundingRequest Create Funding Request
FundingManagerApi getFundingAccount GET /v1/fundingAccounts/{fundingAccountId} Get Funding Account
FundingManagerApi getFundingAccountV2 GET /v2/fundingAccounts/{fundingAccountId} Get Funding Account
FundingManagerApi getFundingAccounts GET /v1/fundingAccounts Get Funding Accounts
FundingManagerApi getFundingAccountsV2 GET /v2/fundingAccounts Get Funding Accounts
FundingManagerApi getSourceAccount GET /v1/sourceAccounts/{sourceAccountId} Get details about given source account.
FundingManagerApi getSourceAccountV2 GET /v2/sourceAccounts/{sourceAccountId} Get details about given source account.
FundingManagerApi getSourceAccountV3 GET /v3/sourceAccounts/{sourceAccountId} Get details about given source account.
FundingManagerApi getSourceAccounts GET /v1/sourceAccounts Get list of source accounts
FundingManagerApi getSourceAccountsV2 GET /v2/sourceAccounts Get list of source accounts
FundingManagerApi getSourceAccountsV3 GET /v3/sourceAccounts Get list of source accounts
FundingManagerApi listFundingAuditDeltas GET /v1/deltas/fundings Get Funding Audit Delta
FundingManagerApi setNotificationsRequest POST /v1/sourceAccounts/{sourceAccountId}/notifications Set notifications
FundingManagerApi transferFunds POST /v2/sourceAccounts/{sourceAccountId}/transfers Transfer Funds between source accounts
FundingManagerApi transferFundsV3 POST /v3/sourceAccounts/{sourceAccountId}/transfers Transfer Funds between source accounts
FundingManagerPrivateApi createFundingAccountV2 POST /v2/fundingAccounts Create Funding Account
FundingManagerPrivateApi deleteSourceAccountV3 DELETE /v3/sourceAccounts/{sourceAccountId} Delete a source account by ID
LoginApi logout POST /v1/logout Logout
LoginApi resetPassword POST /v1/password/reset Reset password
LoginApi validateAccessToken POST /v1/validate validate
LoginApi veloAuth POST /v1/authenticate Authentication endpoint
PayeeInvitationApi getPayeesInvitationStatusV3 GET /v3/payees/payors/{payorId}/invitationStatus Get Payee Invitation Status
PayeeInvitationApi getPayeesInvitationStatusV4 GET /v4/payees/payors/{payorId}/invitationStatus Get Payee Invitation Status
PayeeInvitationApi queryBatchStatusV3 GET /v3/payees/batch/{batchId} Query Batch Status
PayeeInvitationApi queryBatchStatusV4 GET /v4/payees/batch/{batchId} Query Batch Status
PayeeInvitationApi resendPayeeInviteV3 POST /v3/payees/{payeeId}/invite Resend Payee Invite
PayeeInvitationApi resendPayeeInviteV4 POST /v4/payees/{payeeId}/invite Resend Payee Invite
PayeeInvitationApi v3CreatePayee POST /v3/payees Initiate Payee Creation
PayeeInvitationApi v4CreatePayee POST /v4/payees Initiate Payee Creation
PayeesApi deletePayeeByIdV3 DELETE /v3/payees/{payeeId} Delete Payee by Id
PayeesApi deletePayeeByIdV4 DELETE /v4/payees/{payeeId} Delete Payee by Id
PayeesApi getPayeeByIdV3 GET /v3/payees/{payeeId} Get Payee by Id
PayeesApi getPayeeByIdV4 GET /v4/payees/{payeeId} Get Payee by Id
PayeesApi listPayeeChangesV3 GET /v3/payees/deltas List Payee Changes
PayeesApi listPayeeChangesV4 GET /v4/payees/deltas List Payee Changes
PayeesApi listPayeesV3 GET /v3/payees List Payees
PayeesApi listPayeesV4 GET /v4/payees List Payees
PayeesApi payeeDetailsUpdateV3 POST /v3/payees/{payeeId}/payeeDetailsUpdate Update Payee Details
PayeesApi payeeDetailsUpdateV4 POST /v4/payees/{payeeId}/payeeDetailsUpdate Update Payee Details
PayeesApi v3PayeesPayeeIdRemoteIdUpdatePost POST /v3/payees/{payeeId}/remoteIdUpdate Update Payee Remote Id
PayeesApi v4PayeesPayeeIdRemoteIdUpdatePost POST /v4/payees/{payeeId}/remoteIdUpdate Update Payee Remote Id
PaymentAuditServiceApi exportTransactionsCSVV4 GET /v4/paymentaudit/transactions Export Transactions
PaymentAuditServiceApi getFundingsV4 GET /v4/paymentaudit/fundings Get Fundings for Payor
PaymentAuditServiceApi getPaymentDetailsV4 GET /v4/paymentaudit/payments/{paymentId} Get Payment
PaymentAuditServiceApi getPaymentsForPayoutV4 GET /v4/paymentaudit/payouts/{payoutId} Get Payments for Payout
PaymentAuditServiceApi getPayoutStatsV4 GET /v4/paymentaudit/payoutStatistics Get Payout Statistics
PaymentAuditServiceApi getPayoutsForPayorV4 GET /v4/paymentaudit/payouts Get Payouts for Payor
PaymentAuditServiceApi listPaymentChangesV4 GET /v4/payments/deltas List Payment Changes
PaymentAuditServiceApi listPaymentsAuditV4 GET /v4/paymentaudit/payments Get List of Payments
PaymentAuditServiceDeprecatedApi exportTransactionsCSVV3 GET /v3/paymentaudit/transactions V3 Export Transactions
PaymentAuditServiceDeprecatedApi getFundingsV1 GET /v1/paymentaudit/fundings V1 Get Fundings for Payor
PaymentAuditServiceDeprecatedApi getPaymentDetailsV3 GET /v3/paymentaudit/payments/{paymentId} V3 Get Payment
PaymentAuditServiceDeprecatedApi getPaymentsForPayoutPAV3 GET /v3/paymentaudit/payouts/{payoutId} V3 Get Payments for Payout
PaymentAuditServiceDeprecatedApi getPayoutStatsV1 GET /v1/paymentaudit/payoutStatistics V1 Get Payout Statistics
PaymentAuditServiceDeprecatedApi getPayoutsForPayorV3 GET /v3/paymentaudit/payouts V3 Get Payouts for Payor
PaymentAuditServiceDeprecatedApi listPaymentChanges GET /v1/deltas/payments V1 List Payment Changes
PaymentAuditServiceDeprecatedApi listPaymentsAuditV3 GET /v3/paymentaudit/payments V3 Get List of Payments
PayorsApi getPayorById GET /v1/payors/{payorId} Get Payor
PayorsApi getPayorByIdV2 GET /v2/payors/{payorId} Get Payor
PayorsApi payorAddPayorLogo POST /v1/payors/{payorId}/branding/logos Add Logo
PayorsApi payorCreateApiKeyRequest POST /v1/payors/{payorId}/applications/{applicationId}/keys Create API Key
PayorsApi payorCreateApplicationRequest POST /v1/payors/{payorId}/applications Create Application
PayorsApi payorEmailOptOut POST /v1/payors/{payorId}/reminderEmailsUpdate Reminder Email Opt-Out
PayorsApi payorGetBranding GET /v1/payors/{payorId}/branding Get Branding
PayorsApi payorLinks GET /v1/payorLinks List Payor Links
PayorsPrivateApi createPayorLinks POST /v1/payorLinks Create a Payor Link
PayoutServiceApi createQuoteForPayoutV3 POST /v3/payouts/{payoutId}/quote Create a quote for the payout
PayoutServiceApi deschedulePayout DELETE /v3/payouts/{payoutId}/schedule Deschedule a payout
PayoutServiceApi getPaymentsForPayoutV3 GET /v3/payouts/{payoutId}/payments Retrieve payments for a payout
PayoutServiceApi getPayoutSummaryV3 GET /v3/payouts/{payoutId} Get Payout Summary
PayoutServiceApi instructPayoutV3 POST /v3/payouts/{payoutId} Instruct Payout
PayoutServiceApi scheduleForPayout POST /v3/payouts/{payoutId}/schedule Schedule a payout
PayoutServiceApi submitPayoutV3 POST /v3/payouts Submit Payout
PayoutServiceApi withdrawPayment POST /v1/payments/{paymentId}/withdraw Withdraw a Payment
PayoutServiceApi withdrawPayoutV3 DELETE /v3/payouts/{payoutId} Withdraw Payout
TokensApi resendToken POST /v2/users/{userId}/tokens Resend a token
UsersApi deleteUserByIdV2 DELETE /v2/users/{userId} Delete a User
UsersApi disableUserV2 POST /v2/users/{userId}/disable Disable a User
UsersApi enableUserV2 POST /v2/users/{userId}/enable Enable a User
UsersApi getSelf GET /v2/users/self Get Self
UsersApi getUserByIdV2 GET /v2/users/{userId} Get User
UsersApi inviteUser POST /v2/users/invite Invite a User
UsersApi listUsers GET /v2/users List Users
UsersApi registerSms POST /v2/users/registration/sms Register SMS Number
UsersApi resendToken POST /v2/users/{userId}/tokens Resend a token
UsersApi roleUpdate POST /v2/users/{userId}/roleUpdate Update User Role
UsersApi unlockUserV2 POST /v2/users/{userId}/unlock Unlock a User
UsersApi unregisterMFA POST /v2/users/{userId}/mfa/unregister Unregister MFA for the user
UsersApi unregisterMFAForSelf POST /v2/users/self/mfa/unregister Unregister MFA for Self
UsersApi updatePasswordSelf POST /v2/users/self/password Update Password for self
UsersApi userDetailsUpdate POST /v2/users/{userId}/userDetailsUpdate Update User Details
UsersApi userDetailsUpdateForSelf POST /v2/users/self/userDetailsUpdate Update User Details for self
UsersApi validatePasswordSelf POST /v2/users/self/password/validate Validate the proposed password
WebhooksApi createWebhookV1 POST /v1/webhooks Create Webhook
WebhooksApi getWebhookV1 GET /v1/webhooks/{webhookId} Get details about the given webhook.
WebhooksApi listWebhooksV1 GET /v1/webhooks List the details about the webhooks for the given payor.
WebhooksApi pingWebhookV1 POST /v1/webhooks/{webhookId}/ping
WebhooksApi updateWebhookV1 POST /v1/webhooks/{webhookId} Update Webhook

Models

Authorization

OAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL: ``
  • Scopes:
    • ** **: Scopes not required

basicAuth

  • Type: HTTP basic authentication

oAuthVeloBackOffice

  • Type: OAuth
  • Flow: application
  • Authorization URL: ``
  • Scopes:
    • ** **: Scopes not required

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 2.29.127
    • Package version: 2.29.127
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen