Index of every page on this site: llms.txt
All skills
binance avatar

/onchain-pay

@7d1b1f7
by binancebinance/binance-skills-hub1.2k stars
281
Run it yourself

Binance Onchain Pay enables users to buy cryptocurrency with fiat (e.g., EUR, USD) or send existing crypto from their Binance account directly to any external on-chain wallet address in a single flow—no manual withdrawal needed. Enables partners to integrate crypto buying services: - payment-method-list: Get available payment methods (Card, P2P, Google Pay, Apple Pay, etc.) with limits for a fiat/crypto pair - trading-pairs: List all supported fiat currencies and cryptocurrencies - estimated-quote: Get real-time price quote including exchange rate, fees, and estimated crypto amount - pre-order: Create a buy order and get redirect URL to Binance payment flow - order: Query order status and details (processing, completed, failed, etc.) - crypto-network: Get supported blockchain networks with withdraw fees and limits - p2p/trading-pairs: List P2P-specific trading pairs

  • 6 files
  • 26.7 KB
  • Updated 5 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/binance/binance-skills-hub/onchain-pay

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesauthentication.md

≈702 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Binance Onchain-Pay Open API Authentication

Signing Process

All Onchain-Pay Open API requests use RSA SHA256 signature with a PEM private key.

Step 1: Build the Signing Payload

payload = JSON_BODY + TIMESTAMP
  • JSON_BODY: The raw JSON request body string (compact, no trailing newline). If no body is needed, use empty string.
  • TIMESTAMP: Current Unix timestamp in milliseconds (e.g., 1709654400000)

Example:

{"fiatCurrency":"USD","cryptoCurrency":"BTC","totalAmount":100,"amountType":1}1709654400000

Step 2: Sign with RSA SHA256

signature=$(echo -n "$payload" \
  | openssl dgst -sha256 -sign "$PRIVATE_KEY_PATH" \
  | openssl enc -base64 -A)
  • Uses the RSA private key in PEM format
  • SHA256 digest
  • Base64 encoded (single line, no wrapping)

Step 3: Send Request with Headers

All requests are POST with these headers:

Header Value
X-Tesla-ClientId Your client ID (e.g., your-client-id)
X-Tesla-SignAccessToken Your API key
X-Tesla-Signature The RSA signature from Step 2
X-Tesla-Timestamp The timestamp used in signing
Content-Type application/json
x-trace-id (Optional) Trace ID for debugging

Complete Example

# Generate timestamp in milliseconds (cross-platform compatible)
timestamp=$(($(date +%s) * 1000))
api_params='{"fiatCurrency":"USD","cryptoCurrency":"BTC","totalAmount":100,"amountType":1}'
payload="${api_params}${timestamp}"

signature=$(echo -n "$payload" \
  | openssl dgst -sha256 -sign "test.pem" \
  | openssl enc -base64 -A)

curl --location --request POST "https://api.commonservice.io/papi/v1/ramp/connect/buy/payment-method-list" \
  --header "X-Tesla-ClientId: your-client-id" \
  --header "X-Tesla-SignAccessToken: your-api-key" \
  --header "X-Tesla-Signature: $signature" \
  --header "X-Tesla-Timestamp: $timestamp" \
  --header "Content-Type: application/json" \
  --data-raw "$api_params"

Important: Cross-platform Timestamp Generation

Correct (works on macOS, Linux, BSD):

timestamp=$(($(date +%s) * 1000))

Incorrect (do not use):

# ❌ Doesn't work on macOS - outputs literal 'N'
timestamp=$(date +%s%3N)

# ❌ Just appends '000', not true milliseconds
timestamp=$(date +%s000)

On macOS, date doesn't support %N (nanoseconds), which causes date +%s%3N to output something like 1773744478N. This breaks JSON parsing with error:

Unexpected character ('N' (code 78)): was expecting comma to separate Object entries

Security Notes

  • Never expose the PEM private key content
  • Never display the full API key; show first 5 + last 4 characters only (e.g., 2zefb...06h)
  • The PEM file path should be absolute or relative to the working directory

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 7d1b1f7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 5 months ago
metadata
{
  "version": "0.1.2",
  "author": "onchain-pay-team"
}

README badge

README badge for binance/binance-skills-hub/onchain-pay