Skip to content

velopaymentsapi/velo-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go client for Velo

License npm version CircleCI\

Terms and Definitions

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.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.26.124
  • Package version: 2.26.124.beta1
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./velopayments"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for 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 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 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 UpdateWebhookV1 Post /v1/webhooks/{webhookId} Update Webhook

Documentation For Models

Documentation For Authorization

OAuth2

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

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

basicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

oAuthVeloBackOffice

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

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author