Skip to main content

This is a lightweight library that works as a connector to Binance Pay public API

Project description

Binance Pay Public API Connector Python

Python 3.6 License: MIT

This is a lightweight library that works as a connector to Binance Pay public API

Installation

pip install binance-pay-connector

Documentation

https://binance-pay-connector.readthedocs.io

RESTful APIs

Usage examples:

from binance.pay.merchant import Merchant as Client


# Setup merchant API from https://merchant.binance.com/en/dashboard/developers

client = Client(key='<api_key>', secret='<api_secret>')
response = client.get_order(merchantTradeNo="<trade_no>")

# Get an order details
print(response)

Please find examples folder to check for more endpoints.

Optional parameters

PEP8 suggests lowercase with words separated by underscores, but for this connector, the methods' optional parameters should follow their exact naming as in the API documentation.

# Recognised parameter name
response = client.get_order(merchantTradeNo="2223")

# Unrecognised parameter name
response = client.get_order(merchant_trade_no="2223")

Display logs

Setting the log level to DEBUG will log the request URL, payload and response text.

Error

If a request has a parameter that is not provided but required from server, this library will throw an exception binance.pay.error.ParameterRequiredError, except the endpoint that is for creating order. POST /binancepay/openapi/v2/order that used to create order has complicate parameter strucuture, the library doesn't any mandatory parameter. Please see the example file for how to place an order.

Test Case

# In case packages are not installed yet
pip install -r requirements/requirements-test.txt

pytest

Contributing

Contributions are welcome.
If you've found a bug within this project, please open an issue to discuss what you would like to change.
If it's an issue with the API, please open a topic at Binance Developer Community

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

binance-pay-connector-1.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

binance_pay_connector-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file binance-pay-connector-1.0.0.tar.gz.

File metadata

  • Download URL: binance-pay-connector-1.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for binance-pay-connector-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4a91399903825e382c0a4f0a2c0ca65cd97a870d85b359de988979e2f5f0b7a3
MD5 cd7a4b0be49c92321270a90b8dba1d0b
BLAKE2b-256 436376e991ad7e17467b13fa9ff84770116a178efaa9d6ef90f75a5a58e0a678

See more details on using hashes here.

File details

Details for the file binance_pay_connector-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: binance_pay_connector-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for binance_pay_connector-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7a233dec0bbf20afbad46e1277c31e8cab8eb6ef4a9830712e8b4e0bdfec60
MD5 235ff9b5d69d185fcbdf3f94fcc6d2a1
BLAKE2b-256 42f35eaa9f90ac02f786d1ee901519ce712876ba680d7be5270ecdeecca6a231

See more details on using hashes here.

Supported by

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