Skip to main content

No project description provided

Project description

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.client import Client


with Client(token=...) as client:
    # comming soon...

Async

from merchant001_sdk.client 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.client 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.client 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.client 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.client 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.client 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.client 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.client 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.client 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.client import Client


async def main(token: str, transaction_id: 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:

PayemntMethodRate(method='sberbank', rate=103.38)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merchant001-sdk-0.0.11.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merchant001_sdk-0.0.11-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file merchant001-sdk-0.0.11.tar.gz.

File metadata

  • Download URL: merchant001-sdk-0.0.11.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.9.3 CPython/3.11.4

File hashes

Hashes for merchant001-sdk-0.0.11.tar.gz
Algorithm Hash digest
SHA256 33b18d1e70d483f921f53e4b4445963eb63a2376d0b1b2c4e9afc4de6d310200
MD5 94430021070a5b6defb4af8bf66c4613
BLAKE2b-256 1276c116943034706fe31f48e01c8801b4689721f02a03f8abd6ab349e75e028

See more details on using hashes here.

File details

Details for the file merchant001_sdk-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for merchant001_sdk-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 df8e2ece3b92580f925c95fe34de0799b029e06e2a97280e0de47635d14360aa
MD5 5ae8edea1a14603ce4c845810b588947
BLAKE2b-256 0bfb19820ec9309fd662851bd598d3d4dd887a87d4cab31161d2c175b1f626ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page