跳到主要内容

Python SDK

适用于 Python 3.7+ 的 HashNut Python SDK。

安装

pip install hashnut-sdk

快速开始

from hashnut import HashnutClient

client = HashnutClient(
base_url='https://testnet.hashnut.io',
access_key_id=os.getenv('HASHNUT_ACCESS_KEY_ID'),
api_key=os.getenv('HASHNUT_API_KEY')
)

# 创建订单
order = client.orders.create(
merchant_order_id=f'order-{int(time.time())}',
chain_code='erc20',
coin_code='usdt',
amount=0.01,
callback_url='https://your-site.com/api/webhook',
frontend_callback_url='https://your-site.com/payment/success'
)

print(f'Payment URL: {order.payment_url}')

API 参考

完整示例请参见快速开始指南


使用 Python? 查看快速开始 →