PayBox Open API
PayBox is a Web3 multi-chain asset aggregation payment system.
PayBox Open API Documentation
Introduction
PayBox is a Web3 multi-chain asset aggregation payment system. By leveraging SwapBox's cross-chain exchange capability, merchants only need to select the asset they want to receive, while users can choose various on-chain assets they own for payment. Merchants do not need to worry about exchange slippage and rates. We hope this product will help more international internet products and game projects provide easy and fast access to blockchain asset payment capabilities.
Integration Process
Web page to invoke PayBox payment page
Callback notification
Query interface
Demo
1. Integration Process
1.1. Requirements
Register a Nabox ID account
Test environment registration: https://beta.id.nabox.io
Production environment registration: https://id.nabox.io
Provide a callback URL for transaction notification
Create a PayBox cashier and payment QR code
1.2. Glossary
Business System: The application system integrating with PayBox
PayBox: The PayBox cross-chain payment collection system
Merchant: The payment recipient entity registered in PayBox
User: The user of the business system
Payment Chain: The blockchain network where the user initiates the transaction
Payment Asset: The asset transferred by the user on the payment chain
Collection Chain: The blockchain network where the merchant receives the user's payment asset converted to USDT
Collection Address: The blockchain address used by the merchant when registering Nabox ID
1.3. Business Flow
The business system creates a payment order number
Invoke the PayBox payment page, passing in the order number, payment amount, payment chain, etc.
The user completes the transaction on the PayBox payment page
PayBox completes the cross-chain asset exchange
PayBox notifies the business system of the completed transaction through the provided notification URL
The business system can query the transaction order information through the query interface
1.4. Sequence Diagram
2. Web Page to Invoke PayBox Payment Page
Testnet URL: https://dev.web.paybox.id.nabox.io/pay
Mainnet URL: https://paybox.id.nabox.io/pay
Page Parameters: [Specify the required page parameters here]
3. Callback Notification
When the transaction on the payment chain is confirmed and the asset is received on the collection chain, PayBox will call the merchant-provided callback URL to notify the transaction status. The callback URL needs to be provided in advance to PayBox for configuration. PayBox will sign the request parameters, and the business system should verify the signature to ensure reliability.
Request Method: POST
Request Content-Type: Application/json
Request Parameters:
TxState:
Request Parameter Example:
Response: SUCCESS/FAIL
The callback notification will be triggered when the payment chain transaction is confirmed and when the asset is received at the collection address. Payment chain transaction confirmation will only be notified once, regardless of success. The collection address receipt notification will be retried if a response of SUCCESS is not received, or if the call fails. If all retry attempts fail, no further notifications will be sent.
Notification Time Series: [Specify the notification retry sequence here]
Signature Verification Method: ECKey.verify(key, sign, pubKey)
ECKey: Implementation of the ECDSA algorithm (Elliptic Curve Digital Signature Algorithm)
key: The signed content, obtained by concatenating the
outerOrderNo
andsendTime
parameters in the callback request.sign: The signature value in the callback request's
sign
parameterpubKey: The public key for signature verification
Testnet Public Key:
02a6b09b370bf0588e67547f1a5c375cf2d78c5af89a0ced775365ffecb517d8df
Mainnet Public Key:
02b4bcc1ecbe8785fba3d592fea4dc74e9071fa7399a72cd43993046682c877261
ECDSA Algorithm Java Package:
or
Example Code:
4. Query APIs
4.1. Get Supported Chains
Method: GET
Path:
/chains
Parameters: None
Response Data:
chain (string): Chain name
logo (string): Chain logo URL
Response Example:
4.2. Get Supported Assets of a Chain
Method: GET
Path:
/{chain}/assets
Parameters:
chain (string): Chain name from the previous API
Response Data:
assetId (string): Asset ID
symbol (string): Asset symbol
logo (string): Asset logo URL
Response Example:
4.3. Calculate Exchange Price
Method: GET
Path:
/asset/price
Parameters:
chain (string): Payment chain name
assetId (string): Payment asset ID
quantity (integer, optional): Amount of USDT to receive, default is 1 if not specified
Request URL Example:
Response Data:
fromPayAmount (Coin): Required payment asset amount
fee (Coin): Fee amount
Coin Type:
Response Example:
4.4. Query Order Information by Business Order Number
Method: GET
Path:
/order/{address}/{outerOrderNo}
Parameters:
address (string): Payment address
outerOrderNo (string): Business system order number, provided when initiating the payment page
Request URL Example:
Response Data:
Data字段返回值:
TxState:
Response Example:
5. Download Demo
Last updated