Merchant001 SDK
Install
Client-only
For PIP
pip3 install merchant001_sdk
For PDM
pdm add merchant001_sdk
With CLI
For PIP
pip3 install merchant001_sdk[cli]
For PDM
pdm add merchant001_sdk[cli]
Use
Client
Sync
from merchant001_sdk import Client
with Client(token=...) as client:
# comming soon...
Async
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token) as client:
# comming soon...
Methods
In this section I use async-only, but you can use sync/async (as in previous 2-level section).
Merchant Healthcheck
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_merchant_healthcheck()
print(result)
On Success:
MerchantHealthcheck(success=True)
On Error (invalid token for example):
ErrorResult(status_code=401, message='Unavailable api token', error='Unauthorized')
Payment Methods List
Params:
- raw_dict (boolean) - eq. to makeArray, default is false.
- method_names_only (boolean) - eq. to onlyMethod, default is false.
- amount (int; > 0) - eq. to amount, default is null (optional).
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_payment_methods(raw_dict=True, method_names_only=False)
print(result)
On Success:
[PaymentMethodType(type='GATE [RUB/USDT] CARD', methods=[{'type': 'GATE [RUB/USDT] CARD', 'method': 'tinkoff', 'imageUrl': None, 'name': 'Тинькофф'}, {'type': 'GATE [RUB/USDT] CARD', 'method': 'sberbank', 'imageUrl': None, 'name': 'Сбербанк'}])] # raw_dict=False
[PaymentMethodType(type='GATE [RUB/USDT] CARD', methods=['tinkoff', 'sberbank'])] # raw_dict=False, method_names_only=True
{'GATE [RUB/USDT] CARD': {'tinkoff': {'type': 'GATE [RUB/USDT] CARD', 'method': 'tinkoff', 'imageUrl': None, 'name': 'Тинькофф'}, 'sberbank': {'type': 'GATE [RUB/USDT] CARD', 'method': 'sberbank', 'imageUrl': None, 'name': 'Сбербанк'}}} # raw_dict=True
On Error (invalid token for example):
ErrorResult(status_code=401, message='Unavailable api token', error='Unauthorized')
Create Transaction
Params: pricing (mapping[str, mapping[str, str | float]]) - eq. to pricing. provider_type (str) - eq. to selectedProvider.type. provider_method (str) - eq. to selectedProvider.method. is_partner_fee (boolean) - eq. to amount, default is null (optional).
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.create_transaction(
pricing={"local": {"amount": 1, "currency": "RUB"}},
provider_type="GATE [RUB/USDT] CARD",
provider_method="SBERBANK",
is_partner_fee=False,
)
print(result)
Get Transaction
Params:
- transaction_id (str)
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_transaction(transaction_id=transaction_id)
print(result)
Get Transaction Requisite
Params:
- transaction_id (str)
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_transaction_requisite(transaction_id=transaction_id)
print(result)
Claim Transaction as PAID
Params:
- transaction_id (str)
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.claim_transaction_paid(transaction_id=transaction_id)
print(result)
Claim Transaction as CANCELED
Params:
- transaction_id (str)
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.claim_transaction_canceled(transaction_id=transaction_id)
print(result)
Set Transaction payment method
Params:
- transaction_id (str)
- provider_type (str)
- provider_method (str)
from merchant001_sdk import Client
async def main(
token: str, transaction_id: str, provider_type: str, provider_method: str
) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.set_transaction_payment_method(
transaction_id=transaction_id,
provider_type=provider_type,
provider_method=provider_method,
)
print(result)
Get Payment Method Rate
Params:
- payment_method (str)
from merchant001_sdk import Client
async def main(token: str, payment_method: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_payment_method_rate(payment_method=payment_method)
print(result)
On Success:
PaymentMethodRate(method='sberbank', rate=103.38)
Upload payment receipt
Params:
- transaction_id (str)
- receipt_file (str) - filepath or opened file with mode "rb".
- amount (float; optional) - if you need to specify the amount.
from merchant001_sdk import Client
async def main(token: str, transaction_id: str, filepath: str, amount: int) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.upload_payment_receipt(
transaction_id=transaction_id, receipt_file=filepath, amount=amount
)
print(result)
On Success:
StatusStub(status=True)
Metadata
Release files for merchant001_sdk 0.0.21
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 |
|---|---|---|---|---|
| merchant001-sdk-0.0.21.tar.gz | 11.4 kB | Without provenance | Details for merchant001-sdk-0.0.21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| merchant001_sdk-0.0.21-py3-none-any.whl | Python 3 | none | any | Details for merchant001_sdk-0.0.21-py3-none-any.whl |
Total release size: 28.5 kB
Release files / merchant001-sdk-0.0.21.tar.gz
| Download URL | merchant001-sdk-0.0.21.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1693d7a8f999f9bec78d2a0437e7d9e40347da3ba2e9ea3bd6d60d765b2092c
|
|
BLAKE2b-256 checksum How to use checksums |
e9a1f5d2709f54f2623dc04d612a0772eb6e2d09da55417dedd2e45424e5b4ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.9.3 CPython/3.11.4
|
Release files / merchant001_sdk-0.0.21-py3-none-any.whl
| Download URL | merchant001_sdk-0.0.21-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56b9fc1c370c9093b8c71620b6d69dde1e96c8d5205ab25562e1eebd4ed1b7a9
|
|
BLAKE2b-256 checksum How to use checksums |
b4c419db01c906080a7df87456bc30cb0ef870348bd3af453cf71843e3dfb70f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.9.3 CPython/3.11.4
|
Security for merchant001_sdk 0.0.21
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.