Crypto On/Off Ramp API
This document provides a comprehensive guide to integrate with the Pay Agency's Crypto On/Off Ramp API. The Crypto On/Off Ramp API allows seamless on ramp (fiat to crypto) and offramp (crypto to fiat) transactions through a single endpoint. The API endpoint and payload details are provided below, along with examples in multiple programming languages.
API Endpoint
Overview
The Crypto On/Off Ramp API provides a unified solution for both on ramp and off ramp cryptocurrency transactions:
- On ramp (Fiat to Crypto): Convert fiat currency to cryptocurrency
- Off ramp (Crypto to Fiat): Convert cryptocurrency to fiat currency
Both transaction types are handled through the same API endpoint, with the transaction type specified in the request payload.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
first_name | String | First name of the user (3-191 characters, letters only) | Yes |
last_name | String | Last name of the user (3-191 characters, letters only) | Yes |
phone_number | String | Phone number of the user (8-19 digits, with optional + prefix) | Yes |
transaction_type | String | Transaction type: "ONRAMP" (fiat to crypto) or "OFFRAMP" (crypto to fiat) | Yes |
fiat_currency | String | Fiat currency code (3 characters, e.g., USD, EUR) | Yes |
crypto_currency | String | Cryptocurrency code (e.g., BTC, ETH, USDT) | Yes |
crypto_amount | Number | Amount in cryptocurrency (required for OFFRAMP, not allowed for ONRAMP) | Conditional |
fiat_amount | Number | Amount in fiat currency (required for ONRAMP, not allowed for OFFRAMP) | Conditional |
wallet_address | String | Cryptocurrency wallet address for receiving/sending funds | Yes |
ip_address | String | IP address of the user | Yes |
email | String | Email address of the user | Yes |
country | String | Country code (2 characters, ISO 3166-1 alpha-2 format) | Yes |
payment_method | String | Payment method: "CARD", "BANK", or "WALLET" | No |
redirect_url | String | URL to redirect users after transaction | Yes |
webhook_url | String | URL for server-to-server webhook notifications | No |
order_id | String | Unique order from merchant side | No |
terminal_id | String | Connector unique terminal_id (It's usefull when you want to bypass all routing and cascading logic) | No |
Transaction Type Rules
ON RAMP Transactions:
fiat_amount
is requiredcrypto_amount
should not be provided- User pays in fiat currency and receives cryptocurrency
OFFRAMP Transactions:
crypto_amount
is requiredfiat_amount
should not be provided- User sends cryptocurrency and receives fiat currency
Example Payloads
On ramp Transaction (Fiat to Crypto)
Offramp Transaction (Crypto to Fiat)
Example Responses
Success Response
Error Response
Integration Examples
The API uses AES-256-CBC encryption to ensure secure transmission of sensitive data. Before sending the payload, you need to encrypt it using your encryption key and a dynamically generated initialization vector (IV).