Payments API

The API allows developers to integrate their applications into the Capitalist system for automated downloading payments into the system.

Requirements

To use the API, you should have the status of a Verified Business User. Access to the API is activated upon agreement with the Customer Support.

All financial operations performed via the API are labeled using a “security certificate”, so the “Certificate” option should be activated for your account. This option can be activated in  the Security Settings page in the Profile section.

The data required for using the API

  • Username (not the e-mail)
  • Password
  • Certificate file
  • The password to the certificate file if it is encrypted
  • The batch payments data in a special format

The address for queries

https://api.capitalist.net/

Query format

An API query is a regular HTTP 1.1 POST query with the necessary parameters passed in its body.
The content type may be application/x-www-form-urlencoded or multipart/form-data.

Required query parameters

The query should be sent in UTF-8 encoding.
Dot “.” shall be used as the decimal separator for amounts.

ParameterDescription
loginUsername
operationOperation name. For exapmle, get_token.

Access with Plain password

You can use plain password with API (Operation get_token will not required in this case).

Use plain_password parameter instead of token and encrypted_password ones where is authorization is needed.

API operations

Currently, the API supports the following operations:

OperationDescription
Authorization
get_tokenObtaining encryption attributes.
Making payments
import_batch_advancedUploading a batch payment into the system with a possibility to choose the verification method.
process_batchBatch payment confirmation.
get_batch_infoGetting detailed information about the loaded batch payment.
get_documents_history_extObtaining operations history.
documents_searchSearch by payment number from your system.
is_verified_accountChecking whether the account holder is verified.
Working with your accounts
get_accountsObtaining a list of your accounts (wallets).
Other
currency_ratesObtaining of a currency rates.

Format of the reply

By default, the reply is sent in CSV format(separated by semicolons and line wraps) in UTF-8 encoding.

Choosing the response format

Currently two formats are supported: json,CSV format.

To get the reply in a more convenient format, the query should contain the ‘x-response-format’ HTTP header, e.g.

HeaderChosen format
x-response-format: jsonA full-fledged JSON with named parameters
x-response-format: csvCSV is selected by default

The HTTP headers of the response return the homonym header ‘x-response-format’ that contains a real format of the response. They coincide in all cases.

Handling errors

By default (i.e. for the CSV format) the first parameter in the first line of the reply is always an integer (hereinafter referred to as “Error Code” for convenience). If the error code is zero, the operation was successful. Otherwise, the second parameter in the first line is the text of the error. For reply formats json, the code and the error text are passed in the code and message attributes.

Error codes

CodeDescription
0Operation was successful
1System error
2Run-time error (error text should be analyzed)
5User not found (wrong username passed)
10Error attempting to decrypt the password
15Invalid password
16The number of login attempts exceeded. Try 30 minutes later
20Invalid authentication token
25Information queries in batch downloads with over 1,000 entries is forbidden without page-by-page breakdown
110Signature verification error
111The transfer data contains invalid characters
112112 Exceeded number of records in a single batch payment
125Uploaded file cannot be parsed
130Account not found
131At least one source account required
132At least one source account required
135Insufficient finds for operations
150A non-POST query received
151Unknown operation
152API unavailable for the user
170Error creating the wallet
180Unknown confirmation method
181The chosen verification method is inactive
182Digital signature missing
185Error importing a batch payment. The payment amount is equal to zero. The 2nd line is “payment id” (see the import_batch_advanced operation)
186Error importing a batch payment. Contact SupportSupport for details.
187Error importing mass payment due to temporary unavailability of one of the types of payments. Second line contains zero-based number of record in batch file.
188This error similar to error 185. Used for single-record masspayments. Error text contains declination comment.
190 – 210get_document_fee operation errors
190Unknown document type
191Unknown service provider code
192Unknown payment urgency (wire)
193Recipient not specified
194You should be the owner of the beneficiary account
195You should be the owner of the debit account
196Transfer amount should be greater than zero
197Failure sending confirmation code
198Invalid verification code
200Account does not exist
202Wrong request params

If you failed to find the Error Code description, please refer to customer service.

Examples of working with PHP

The files is available at github

https://github.com/capitalist-net/php-api-samples