This document describes how to connect the BityclePay cryptocurrency payment gateway to e-commerce platforms. It includes a general explanation of the requirements for requesting payments from the BityclePay payment gateway by the merchant. This service uses the standard web service method over the secure https protocol to perform electronic payments.
To use BityclePay's web service, you must use the provided web service addresses, methods, and parameters.
This section is for retrieving the tokens supported by BityclePay for payments.
BASE_URL: 'https://api.ramzpay.org/pg/v1'
URL: /availableTokens
Method: GET
Auth required: NO
Permissions required: None
Condition: If the request is successful
Code: 200
Content example
{
"tokens": [
"usdt"
]
}
This section is used to send a payment request to BityclePay.
Name | Type | Required | Description |
---|---|---|---|
merchant | String | Yes | The unique code of the merchant |
description | String | No | Transaction description |
callback_url | String | Yes | URL for notifying the merchant about a new payment |
token | String | Yes | Accepted Tokens(Currently, only USDT is accepted) |
String | No | The email related to the transaction (payer's email) |
BASE_URL: 'https://api.ramzpay.org/pg/v1'
URL: /requestPay
Method: POST
Auth required: NO
Permissions required: None
Data constraints
{
"merchant": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"description": "this is test",
"callback_url":"https://merchantwebsite.com/ramzpay/callback/",
"email": "mycustomeremail@email.com"
}
Condition: If the request is successful
Code: 200
Content example
{
"terminalId": "100000000000000044634",
"token": "usdt",
"addresses": [
{
"address": "0xEdfdff9c294Fc431898F4edb0Da6C48e3DE20fc9",
"displayName": "BSC(BEP20) - Tether",
"chainId": "1056",
"chainName": "BSC"
},
{
"address": "0xEdfdff9c294Fc431898F4edb0Da6C48e3DE20fc9",
"displayName": "Polygon - Tether",
"chainId": "1137",
"chainName": "Polygon"
},
{
"address": "TP2MCDnv59qAEhZZr4TxRgRK7cnXsiZdFB",
"displayName": "Tron(TRC20) - Tether",
"chainId": "1000",
"chainName": "Tron"
},
{
"address": "0xEdfdff9c294Fc431898F4edb0Da6C48e3DE20fc9",
"displayName": "Ethereum(ERC20) - Tether",
"chainId": "1001",
"chainName": "Ethereum"
}
]
}
Returned Field Name | Description |
---|---|
address | The deposit address for the specified network |
displayName | The display name of the cryptocurrency |
chainId | The ID of the payment network |
chainName | The name of the payment network |
Method: POST
Name | Description |
---|---|
terminalId | Terminal number |
trxRefId | Transaction reference number |
This section is used to inquire about a transaction.
Name | Type | Required | Description |
---|---|---|---|
merchant | String | Yes | The unique code of the merchant |
terminalId | String | Yes | The terminal ID related to the transaction |
trxRefId | String | No | The transaction reference number |
page | Number | No | Page number (if only terminalId is sent) |
perpage | Number | No | Number of items per page (if only terminalId is sent) |
BASE_URL: 'https://api.ramzpay.org/pg/v1'
URL: /inquiryPay
Method: POST
Auth required: NO
Permissions required: None
Data constraints without trxRefId
If trxRefId is not sent, all successful transactions for the terminal will be returned in a paginated response.
{
"merchant": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"terminalId": "100000000000000044634",
"page": 1,
"perPage": 15
}
Condition: If the request is successful
Code: 200
Content example without trxRefId
{
"transactions": {
"data": [
{
"terminalId": "100000000000000044634",
"token": "usdt",
"trxRefId": "1137100639448111",
"status": "SUCCESS",
"amount": 0.2,
"fee": 0.1,
"trx_hash": "0x6ff28fed7308706a22f002c86f7d0d4c3573794f953821cf87a69c82637a0988",
"network": "POLYGON_MUMBAI",
"to": "0xA9D85351d5DE0c921F7c7f5AD39896dbE86C8969"
},
{
"terminalId": "100000000000000044623",
"token": "usdt",
"trxRefId": "1137100639438801",
"status": "SUCCESS",
"amount": 0.3,
"fee": 0.1,
"trx_hash": "0x8cca1aca4cf6f8b1dc7343066577ba29f2d5b068b7322911b68a3cf467871f5c",
"network": "POLYGON_MUMBAI",
"to": "0xA9D85351d5DE0c921F7c7f5AD39896dbE86C8969"
}
],
"total": 2,
"page": 1,
"perPage": 15
}
}
Data constraints with trxRefId
If trxRefId is specified in the request body, only the details of the transaction corresponding to the specified trxRefId will be returned.
{
"merchant": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"terminalId":"100000000000000044634",
"trxRefId":"113746090220182"
}
Condition: If the request is successful
Code: 200
Content example with trxRefId
{
"transaction": {
"terminalId": "100000000000000044634",
"token": "usdt",
"trxRefId": "1137100639448111",
"status": "SUCCESS",
"amount": 0.2,
"fee": 0.1,
"trx_hash": "0x6ff28fed7308706a22f002c86f7d0d4c3573794f953821cf87a69c82637a0988",
"to": "0xA9D85351d5DE0c921F7c7f5AD39896dbE86C8969",
"network": "POLYGON_MUMBAI"
}
}
You can view sample PHP and Laravel code in this section.
Warning: You need to obtain the merchant code from the BityclePay dashboard and then use its web services.
In this code, a deposit transaction request is created. The sample code below is for the requestPay section in Laravel.
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Http;
class TestController extends Controller
{
public function requestPay()
{
$baseUrl = 'https://api.ramzpay.org/pg/v1';
$merchant = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$response = Http::post($baseUrl . '/requestPay', [
'merchant' => $merchant,
'token' => 'usdt',
'description' => 'order #100',
'callback_url' => "https://mysite.ir/callback/",
'email' => 'myclientemail@email.com',
]);
return $response->json();
}
}
In this code, a transaction verification request is made. The sample code below is for the inquiryPay section in Laravel.
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Http;
class TestController extends Controller
{
public function inquiryPay()
{
$baseUrl = 'https://api.ramzpay.org/pg/v1';
$merchant = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$response = Http::post($baseUrl . '/inquiryPay', [
'merchant' => $merchant,
'terminalId' => '100000000000000044623',
'trxRefId' => '1801100639448111'
]);
return $response->json();
}
}
In this code, a deposit transaction request is created. The sample code below is for the requestPay section in PHP.
<?php
namespace App\Http\Controllers;
class TestController
{
private $baseUrl = 'https://api.ramzpay.org/pg/v1';
private $merchant = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
public function requestPay()
{
$url = $this->baseUrl . '/requestPay';
$data = [
'merchant' => $merchant,
'token' => 'usdt',
'description' => 'order #100',
'callback_url' => "https://mysite.ir/callback/",
'email' => 'myclientemail@email.com',
];
$response = $this->makePostRequest($url, $data);
return json_decode($response, true);
}
private function makePostRequest($url, $data)
{
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
// Execute cURL session and get the result
$result = curl_exec($ch);
// Close cURL session
curl_close($ch);
return $result;
}
}
In this code, a transaction verification request is made. The sample code below is for the inquiryPay section in PHP.
<?php
namespace App\Http\Controllers;
class TestController
{
private $baseUrl = 'https://api.ramzpay.org/pg/v1';
private $merchant = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
public function inquiryPay()
{
$url = $this->baseUrl . '/inquiryPay';
$data = [
'merchant' => $merchant,
'terminalId' => '100000000000000044623',
'trxRefId' => '1801100639448111'
];
$response = $this->makePostRequest($url, $data);
return json_decode($response, true);
}
private function makePostRequest($url, $data)
{
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
// Execute cURL session and get the result
$result = curl_exec($ch);
// Close cURL session
curl_close($ch);
return $result;
}
}
Errors that may occur in BityclePay along with their descriptions are as follows:
Type | Field | Code | Message | Description |
---|---|---|---|---|
general | merchant | 422 | "merchant" is required | Merchant code is empty |
general | merchant | 422 | "merchant" is invalid | Merchant code is invalid |
general | - | 422 | "ip address" is not valid | The requester's IP address does not match the IP address set in the BityclePay dashboard |
requestPay | callback_url | 422 | "callback_url" is required | callback_url is empty |
requestPay | callback_url | 422 | "callback_url" must be a valid uri | callback_url is not valid |
requestPay | description | 422 | "description" length must be less than or equal to 254 characters long | The description text exceeds 254 characters |
requestPay | 422 | "email" must be a valid email | The entered email is not valid | |
requestPay | token | 422 | "token" is required | Token is empty |
requestPay | token | 422 | "token" must be [usdt] | The entered token is not in the list of supported tokens |
inquiryPay | terminalId | 422 | "terminalId" is required" | Terminal ID is empty |
requestPay | - | 429 | max daily requests reached | The number of daily address generation requests has exceeded the limit |
general | - | 500 | Internal Server Error | Server error in processing the request |
02191031651
info@bitycle.com
تهران، میدان آزادی، کارخانه نوآوری آزادی، سوله دیجی نکست