Paymentsgate Python SDK for Payments REST API
Requirements
Installation
The simplest way to install SDK is to use PIP:
pip install paymentsgate
Basic usage
from paymentsgate import ApiClient, Credentials, Currencies
# minimal configuration
config = Credentials().fromFile('/path/to/credentials.json');
# create ApiClient
client = ApiClient(config, baseUrl='https://api.example.com');
# request quote
res = cli.Quote(
{
"amount": 10.10,
"currency_from": Currencies.EUR,
"currency_to": Currencies.AZN,
}
)
print(res);
The credentials.json file is used to connect to the client and contains all necessary data to use the API. This file can be obtained in your personal cabinet, in the service accounts section. Follow the instructions in the documentation to issue new keys. If you already have keys, but you don't feel comfortable storing them in a file, you can use client initialization via variables. In this case, the key data can be stored in external storage instead of on the file system:
from paymentsgate import ApiClient, Credentials
config = Credentials(
account_id="00000000-4000-4000-0000-00000000000a"
public_key="LS0tLS1CRUdJTiBSU0EgUFJJVkFUNSUlFb3dJQk..."
)
client = ApiClient(config, baseUrl='https://api.example.com');
...
*It is important to note that the data format for key transfer is base46.
Examples
create PayIn
res = cli.PayIn(
{
"amount": 10.10,
"currency": Currencies.AZN,
"invoiceId": "INVOICE-112123124",
"clientId": "",
"successUrl": "https://example.com/success",
"failUrl": "https://example.com/fail",
"type": InvoiceTypes.m10
}
)
print(res);
create PayOut
res = cli.PayOut(
{
"amount": 5.12,
"currencyTo": Currencies.EUR,
"invoiceId": "INVOICE-112123124",
"clientId": "CLIENT-003010023004",
"baseCurrency": CurrencyTypes.fiat,
"feesStrategy": FeesStrategy.add,
"recipient": {
"account_number": "4000000000000012",
"account_owner": "CARD HOLDER",
"type": CredentialsTypes.card
}
}
)
print(res);
Error handling
try:
res = cli.PayOut(
{
"amount": 5.12,
"currencyTo": Currencies.EUR,
"invoiceId": "INVOICE-112123124",
"clientId": "CLIENT-003010023004",
"baseCurrency": CurrencyTypes.fiat,
"feesStrategy": FeesStrategy.add,
"recipient": {
"account_number": "4000000000000012",
"account_owner": "CARD HOLDER",
"type": CredentialsTypes.card
}
}
)
print(res);
except APIAuthenticationError as err:
print(f"Authentication fail: {err.message}")
except APIResponseError as err:
print(f"Exception: {err.error}; Message: {err.message}")
Metadata
Release files for paymentsgate 1.5.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| paymentsgate-1.5.17.tar.gz | 13.8 kB | Without provenance | Details for paymentsgate-1.5.17.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| paymentsgate-1.5.17-py3-none-any.whl | Python 3 | none | any | Details for paymentsgate-1.5.17-py3-none-any.whl |
Total release size: 29.7 kB
Release files / paymentsgate-1.5.17.tar.gz
| Download URL | paymentsgate-1.5.17.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ff1979c3ea5d2b01a1afec1eca377a3c5c8d5b6570467843e439175973b0fc8
|
|
BLAKE2b-256 checksum How to use checksums |
02618a4ee48c318e81a44ef72c933c4ff449bb88e4035d96b68f67cbd77b969e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.14.3 Darwin/24.5.0
|
Release files / paymentsgate-1.5.17-py3-none-any.whl
| Download URL | paymentsgate-1.5.17-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05250af14b8226ed4150a75ea7d52ff17081fb44365392f049d98d02dafc5932
|
|
BLAKE2b-256 checksum How to use checksums |
96fd1f612867c8754cb4afe815d67ff07d974aad1341783fd985b63a3ffb9027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.14.3 Darwin/24.5.0
|
Security for paymentsgate 1.5.17
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.