Do you have an online store, landing page, or sell goods and services online but still don’t have a convenient way to accept payments? With our API, you’ll unlock new opportunities for your business! Accept payments from various banks, cards, and popular payment systems at attractive rates for your clients — easily, securely, and with full automation of the process.
Automatic orders 24/7, instant IPN notifications, easy integration, and reliable transaction protection with digital signatures and API keys. Full control over every exchange: set your own callback URLs, configure IPN, use custom fields, and integrate the solution to fit your needs. Join us — it’s simpler, faster, and more profitable with us!
AlwaysMoney provides an API for currency exchange automation. Below are the key integration steps: from obtaining available exchange directions to creating an order and tracking its status via IPN. The examples use PHP (cURL) requests.
API Entry Point: https://alwaysmoney.org/api/userapi/v1/
– all methods are called using this base URL.
Authorization: is done via HTTP headers: API-LOGIN
(your API login) and API-KEY
(your secret API key). Optionally, you can specify the response language using the API-LANG
header (e.g., ru
for Russian). All requests are made via POST, with parameters passed in the body. Responses are returned in JSON format.
The first step is to get the list of currencies and available exchange directions. Use the get_direction_currencies
and get_directions
methods for this.
get_direction_currencies
— returns a list of currencies that can be given (give) and received (get).get_directions
— returns a list of exchange directions (currency pairs).Example 1a: Getting the list of available currencies
<?php
$ch = curl_init("https://alwaysmoney.org/api/userapi/v1/get_direction_currencies");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"API-LOGIN: YOUR_API_LOGIN",
"API-KEY: YOUR_API_KEY",
"API-LANG: ru"
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
?>
Example response:
{
"give": [
{ "id": 1, "title": "Bitcoin (BTC)", "logo": "https://.../btc.png" },
{ "id": 2, "title": "Ethereum (ETH)", "logo": "https://.../eth.png" }
],
"get": [
{ "id": 5, "title": "Visa/MasterCard USD", "logo": "https://.../visa.png" },
{ "id": 6, "title": "PerfectMoney USD", "logo": "https://.../pm.png" }
]
}
The response contains two arrays: give
(currencies for giving) and get
(currencies for receiving). Each element contains the currency id, name, and logo link.
Example 1b: Getting exchange directions for Bitcoin
<?php
$ch = curl_init("https://alwaysmoney.org/api/userapi/v1/get_directions");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"API-LOGIN: YOUR_API_LOGIN",
"API-KEY: YOUR_API_KEY",
"API-LANG: ru"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "currency_id_give=1");
$response = curl_exec($ch);
curl_close($ch);
$directions = json_decode($response, true);
print_r($directions);
?>
Example response:
[
{
"direction_id": 101,
"currency_give_id": 1,
"currency_give_title": "Bitcoin (BTC)",
"currency_get_id": 6,
"currency_get_title": "PerfectMoney USD"
},
{
"direction_id": 102,
"currency_give_id": 1,
"currency_give_title": "Bitcoin (BTC)",
"currency_get_id": 5,
"currency_get_title": "Visa/MasterCard USD"
}
]
The response contains exchange directions for the selected currency. This data will help when creating orders and making subsequent requests.
Having the desired direction_id
, you can request detailed information about it using the get_direction
method. This method returns the current exchange conditions: rate, available reserve, min and max amounts, commission, and other parameters. It also returns lists of additional fields that need to be filled out for this direction (e.g., account numbers, recipient names).
Before creating an order, always check the limits (min/max) and reserve to make sure the exchange is possible for the specified amount.
Example 2: Requesting information for a direction (for example direction_id = 101
, BTC → PerfectMoney USD exchange)
<?php
$ch = curl_init("https://alwaysmoney.org/api/userapi/v1/get_direction");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"API-LOGIN: YOUR_API_LOGIN",
"API-KEY: YOUR_API_KEY",
"API-LANG: ru"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "direction_id=101");
$response = curl_exec($ch);
curl_close($ch);
$info = json_decode($response, true);
print_r($info);
?>
Example response (main parameters):
{
"id": 101,
"url": "https://alwaysmoney.org/exchange/BTC-to-PMUSD",
"currency_code_give": "BTC",
"currency_code_get": "USD",
"reserve": 5000.00,
"course_give": 1,
"course_get": 48000,
"min_give": "0.001",
"max_give": "10",
"min_get": "no",
"max_get": "no",
"com_give": "0%",
"com_get": "0%"
}
This example shows that the BTC → PerfectMoney USD direction has a rate of about 1 BTC = 48,000 USD, a minimum give amount of 0.001 BTC, and a maximum of 10 BTC. The reserve for this direction is 5000 USD. The com_give
and com_get
fields show 0% — no additional fees. The values min_get
and max_get
as "no"
mean no explicit min/max limits on the receive amount.
The method also returns give_fields
, get_fields
, and dir_fields
lists (if required), describing the data that needs to be provided for the exchange (e.g., wallet number or recipient name).
When the user has selected a direction and entered an amount, it’s recommended to calculate the exact exchange result with the current rate and possible commissions before creating an order. For this, the get_calc
method is used — the exchange calculator.
Parameters:
direction_id
— exchange direction ID.calc_amount
— amount for calculation.calc_action
— amount type: 1
if the amount is in the “give” currency, 2
if the amount is in the “get” currency.The API returns the calculation result: how much the user gives and receives including commissions, as well as updated rate and reserve data. This method is convenient for dynamic recalculation when the user enters the amount.
Example 3: The user wants to exchange 0.005 BTC to USD (PerfectMoney)
<?php
$ch = curl_init("https://alwaysmoney.org/api/userapi/v1/get_calc");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"API-LOGIN: YOUR_API_LOGIN",
"API-KEY: YOUR_API_KEY",
"API-LANG: ru"
]);
$postData = [
"direction_id" => 101,
"calc_amount" => 0.005,
"calc_action" => 1
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
$calcResult = json_decode($response, true);
print_r($calcResult);
?>
Example response:
{
"currency_code_give": "BTC",
"currency_code_get": "USD",
"reserve": 5000.00,
"course_give": 1,
"course_get": 48000,
"sum_give": 0.005,
"sum_give_com": 0.005,
"sum_get": 240.00,
"sum_get_com": 240.00,
"com_give": "0%",
"com_get": "0%",
"min_give": "0.001",
"max_give": "10",
"min_get": "no",
"max_get": "no",
"changed": 0
}
The example shows that 0.005 BTC is equivalent to 240 USD. The sum_give_com
and sum_get_com
fields show amounts including commission (here they are equal due to no commission). The flag changed=0
means the amount is valid; if the amount was below the minimum, the API would change it and return changed=1
.
The get_calc
method allows you to show the user the final amount before creating an order and avoid errors (e.g., due to a too small amount).
When all details are checked and the user confirms their intent to exchange, you can create an order using the create_bid
method. This request registers the exchange on the AlwaysMoney side.
Main parameters:
direction_id
— exchange direction ID.calc_amount
— exchange amount.calc_action
— amount type: 1
if amount is in “give” currency, 2
if in “get” currency.account2
— account/address to receive funds (e.g., PerfectMoney account).cfN
— additional data (e.g., cf6
for email).callback_url
— your server’s URL for IPN notifications about order status.Example 4: Creating an order (0.005 BTC → PerfectMoney USD exchange)
<?php
$ch = curl_init("https://alwaysmoney.org/api/userapi/v1/create_bid");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"API-LOGIN: YOUR_API_LOGIN",
"API-KEY: YOUR_API_KEY",
"API-LANG: ru"
]);
$orderData = [
"direction_id" => 101,
"calc_amount" => 0.005,
"calc_action" => 1,
"account2" => "U1234567",
"cf6" => "[email protected]",
"callback_url" => "https://example.com/ipn_handler.php"
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($orderData));
$response = curl_exec($ch);
curl_close($ch);
$order = json_decode($response, true);
print_r($order);
?>
Example response:
{
"id": 5001,
"hash": "a1b2c3d4",
"status": "created",
"status_title": "Awaiting payment",
"psys_give": "Bitcoin",
"psys_get": "PerfectMoney",
"currency_code_give": "BTC",
"currency_code_get": "USD",
"amount_give": 0.005,
"amount_get": 240.00,
"api_actions": {
"instruction": "Send 0.005 BTC to address 1ABC... After receipt, we will send 240 USD to your PerfectMoney account U1234567.",
"pay_amount": 0.005,
"type": "manual",
"cancel": "api",
"pay": "api"
},
"url": "https://alwaysmoney.org/exchange/5001"
}
The order has been successfully created. The response includes the order id
(5001), its status
(created — awaiting payment) and instruction
describing how to pay. The user must transfer funds according to the instruction. The url
links to the order page on AlwaysMoney’s website.
Instant Payment Notification (IPN) is a mechanism for AlwaysMoney to notify your server about order status changes. After creating an order and providing callback_url
, the service sends POST requests to this URL when the order status changes.
For example, you will receive a notification when the funds are received from the user (order paid) or when the exchange is completed and the funds sent.
What comes in IPN:
bid_id
— order IDstatus
— new order statusaccount1
, account2
— payment detailscfN
— additional order fieldssign
— digital signature for authenticity verificationExample of an IPN hаndler in PHP (ipn_handler.php):
<?php
// Get POST data
$postData = $_POST;
$bidId = $postData['bid_id'] ?? null;
$newStatus = $postData['status'] ?? null;
$recipientAccount = $postData['account2'] ?? null;
$receivedSign = $postData['sign'] ?? '';
$secretKey = "YOUR_API_KEY";
// Calculate signature
$expectedSign = hash('sha256', $bidId . $newStatus . $secretKey);
// Verify signature
if ($receivedSign !== $expectedSign) {
http_response_code(400);
exit("Invalid signature");
}
// Process status
// For example, updаte the order status in your database
// If $newStatus == 'paid' — order is paid
// If $newStatus == 'success' — exchange is completed
http_response_code(200);
echo "OK";
?>
Security recommendations:
Roles of callback_url and clientCallbackUrl:
callback_url
(IPN) — server-side callback for automatically updating status in your systеm. It works independently of user actions.clientCallbackUrl
— URL for redirecting the user after completing the order (e.g., to a results page on your site).Using these approaches together improves reliability and enhances the user experience: IPN ensures that your systеm status is always up-to-date, while clientCallbackUrl returns the user to your site with the operation result.
By following this guide, you can successfully integrate the AlwaysMoney exchange service into your application. We have sequentially:
All requests are made via POST using your API-LOGIN
and API-KEY
. Responses are returned in JSON format.
Use the provided PHP/cURL examples as a foundation, adapting them to your API-LOGIN
, API-KEY
, required parameters, and your application logic.
Happy integrating!