Binance Pay Prime — Integration Guideline
This guideline helps partners (merchants) integrate Binance Pay Prime's Open API from scratch. Follow the steps below to go from zero to live.
Table of Contents
- Before You Begin
- Onboarding Checklist
- Environment Setup
- Authentication & Request Signing
- Quick Integration Path
- Step-by-Step: Buy Flow Integration
- Step-by-Step: Sell Flow Integration
- Webhook Integration
- Merchant-Side API Implementation
- Market Data APIs (Optional)
- Error Handling
- Testing & Go-Live Checklist
- Best Practices
- FAQ
- Documentation Notes
1. Before You Begin
What is Binance Pay Prime?
Binance Pay Prime is a turnkey crypto Buy/Sell solution that enables banks, fintechs, and platforms to offer crypto services directly inside their own apps — without building complex infrastructure from scratch. Binance handles the liquidity, order execution, and crypto infrastructure; you keep control over your fiat operations and customer relationships.
Core Capabilities
| Capability | Description |
|---|---|
| Buy Crypto | Users buy crypto with fiat; Binance executes the trade |
| Sell Crypto | Users sell crypto for fiat; Binance executes and you handle fiat transfer |
| Real-Time Quotes | Fetch live price quotes with custom spread support |
| Transaction Mgmt | Query single or bulk transactions, monitor status |
| Webhook | Receive real-time order status notifications |
| Market Data | Kline, discover price, symbol detail for building UIs |
Architecture Overview
┌───────────┐ ┌────────────────────┐ ┌─────────────────────┐
│ End User │ ◄─────► │ Your App / API │ ◄─────► │ Binance Pay Prime │
│ │ │ (Merchant Side) │ │ Open API │
└───────────┘ └────────────────────┘ └─────────────────────┘
│ │
│ Merchant APIs │ Webhook
│ (Check Txn / Refund / │ (Order status
│ Transfer) │ notifications)
◄──────────────────────────────┘
Key points:
- All API communication is server-to-server (your backend ↔ Binance).
- Most APIs require a
userIdparameter — this is the Binance sub-account ID obtained after completing user onboarding via Binance Link KYC SaaS. You must integrate Binance Link first before calling Pay Prime APIs. - You MUST implement merchant-side APIs for Binance to call back (see Section 9).
- Webhook provides asynchronous order status updates.
2. Onboarding Checklist
Before calling any API, complete the following with the Binance Pay Prime team:
Items You Provide to Binance
| # | Item | Description |
|---|---|---|
| 1 | RSA Public Key | Your public key for API request signing (1024-bit RSA). Keep the private key safe! |
| 2 | IP Whitelist | IP addresses of your servers that will call Binance APIs |
| 3 | Webhook Callback URL | The HTTPS endpoint where Binance sends webhook notifications |
| 4 | Merchant-Side API URLs | Endpoints for Check Transaction, Refund (Buy), and Transfer (Sell) |
Items Binance Provides to You
| # | Item | Description |
|---|---|---|
| 1 | Client ID | Your unique partner identifier (X-Tesla-ClientId) |
| 2 | Sign Access Token | Access token for API authentication (X-Tesla-SignAccessToken) |
| 3 | Webhook Public Key | Binance's public key for verifying webhook signatures |
Recommendation: Start integration in the QA environment first. Contact the Binance Pay Prime team for QA base URLs.
3. Environment Setup
Base URLs
| Environment | URL |
|---|---|
| QA | Please ask for Binance Pay Prime team |
| Production | Please ask for Binance Pay Prime team |
Required HTTP Headers (Every Request)
| Header | Value |
|---|---|
Content-Type | application/json |
X-Tesla-ClientId | Your Client ID |
X-Tesla-SignAccessToken | Your Sign Access Token |
X-Tesla-Timestamp | Current timestamp in milliseconds |
X-Tesla-Signature | RSA SHA256 signature of requestBody + timestamp |
4. Authentication & Request Signing
All API requests must be signed with SHA256withRSA. The signing payload is:
signPayload = JSON_REQUEST_BODY + TIMESTAMP_IN_MILLISECONDS
Step-by-Step Signing
- Generate RSA Key Pair (1024-bit) — keep the private key secret, share the public key with Binance.
- Prepare the payload: concatenate the JSON request body (as a string) with the timestamp.
- Sign the payload with your private key using SHA256withRSA.
- Base64-encode the signature.
- Set HTTP headers with the signature, timestamp, client ID, and access token.
Java Example
import org.apache.commons.codec.binary.Base64;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
public class ConnectPrimeSigner {
/**
* Full signing example: build headers for a Pay Prime API request.
*/
public static Map<String, String> buildHeaders(
String clientId, String accessToken,
String privateKeyBase64, String jsonBody) throws Exception {
long timestamp = System.currentTimeMillis();
PrivateKey privateKey = loadPrivateKey(privateKeyBase64);
String signature = sign(jsonBody + timestamp, privateKey);
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("X-Tesla-ClientId", clientId);
headers.put("X-Tesla-SignAccessToken", accessToken);
headers.put("X-Tesla-Timestamp", String.valueOf(timestamp));
headers.put("X-Tesla-Signature", signature);
return headers;
}
private static PrivateKey loadPrivateKey(String base64Key) throws Exception {
byte[] keyBytes = Base64.decodeBase64(base64Key);
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes);
return KeyFactory.getInstance("RSA").generatePrivate(spec);
}
private static String sign(String data, PrivateKey privateKey) throws Exception {
Signature sig = Signature.getInstance("SHA256withRSA");
sig.initSign(privateKey);
sig.update(data.getBytes("UTF-8"));
return Base64.encodeBase64String(sig.sign());
}
}
Postman Setup (Quick Testing)
For quick testing with Postman, refer to API Request Signing — Postman Section.