Note: Replace YOUR_ACCESS_TOKEN with a valid access token when making requests.
Learn more about Authorization
/api/vouchers/buy/confirmThis endpoint confirms the purchase of a voucher by processing the payment from the specified wallet. After successful processing, it creates a new voucher with a unique code and returns all voucher details including the activation code.
Important Notes:
USD Wallets Only: Only USD wallets are allowed for voucher purchases. Ensure your wallet currency is USD before making the request.
User Authorization: Valid bearer token is required. The user must not be blocked.
Sufficient Balance: The wallet must have enough funds to cover both the voucher amount and commission fees.
Voucher Expiration: Created vouchers have a 90-day validity period from the creation date.
POSThttps://api.money-go.com/api/vouchers/buy/confirmAuthorization: Bearer YOUR_ACCESS_TOKENContent-Type: application/json
Note: Replace YOUR_ACCESS_TOKEN with a valid access token when making requests.
Learn more about Authorization
The following JSON body must be sent with the POST request:
{ "voucher_amount": 100.00, "wallet_from": "U123456", "additional": "Payment reference #12345"}| Field | Type | Required | Description |
|---|---|---|---|
| voucher_amount | number | Yes | The desired voucher amount in USD. |
| wallet_from | string | Yes | Your USD wallet number from which funds will be debited. |
| additional | string | No | Optional additional information or payment reference. |
curl -X POST "https://api.money-go.com/api/vouchers/buy/confirm" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "voucher_amount": 100.00, "wallet_from": "U123456", "additional": "Payment reference #12345" }'<?php$url = "https://api.money-go.com/api/vouchers/buy/confirm";$data = [ "voucher_amount" => 100.00, "wallet_from" => "U123456", "additional" => "Payment reference #12345"];
$options = [ 'http' => [ 'header' => [ "Authorization: Bearer YOUR_ACCESS_TOKEN", "Content-Type: application/json" ], 'method' => 'POST', 'content' => json_encode($data) ]];
$context = stream_context_create($options);$result = file_get_contents($url, false, $context);
if ($result === FALSE) { die('Error occurred while purchasing voucher');}
$response = json_decode($result, true);print_r($response);import fetch from 'node-fetch';
interface VoucherPurchaseRequest { voucher_amount: number; wallet_from: string; additional?: string;}
async function purchaseVoucher(): Promise<void> { const url = "https://api.money-go.com/api/vouchers/buy/confirm"; const requestData: VoucherPurchaseRequest = { voucher_amount: 100.00, wallet_from: "U123456", additional: "Payment reference #12345" };
try { const response = await fetch(url, { method: "POST", headers: { "Authorization": "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify(requestData) });
if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); }
const data = await response.json(); console.log("Voucher Purchase:", data); } catch (error) { console.error("Error purchasing voucher:", error); }}
purchaseVoucher();{ "voucher_number": "1001", "voucher_code": "VCH-ABC123-XYZ789-DEF456-GHI012", "voucher_amount": 100.00, "voucher_currency": "USD", "fee_percent": 2.5, "wallet_amount": 102.50, "wallet_currency": "USD", "status": 0, "date_created": "2024-01-15T10:00:00Z", "expired_at": "2024-04-15T10:00:00Z"}| Field | Type | Description |
|---|---|---|
| voucher_number | string | Unique voucher number (internal ID). |
| voucher_code | string | Voucher activation code (32-character encrypted code). |
| voucher_amount | number | The voucher amount (rounded according to ISO mathematical rules) |
| voucher_currency | string | The voucher currency (always “USD”). |
| fee_percent | number | The commission percentage charged by MoneyGo. |
| wallet_amount | number | Total amount debited from wallet (voucher + commission). |
| wallet_currency | string | The currency of the wallet (should match voucher currency). |
| status | number | Voucher status (0 = awaiting activation, 1 = activated, 2 = expired, 3 = cancelled). |
| date_created | string | ISO 8601 timestamp when the voucher was created. |
| expired_at | string | ISO 8601 timestamp when the voucher expires (90 days from creation). |
When a POST request is made to the /api/vouchers/buy/confirm endpoint, the API may return error responses with HTTP status codes 401 or 422 if any validation fails. Below is a table summarizing the possible error responses:
| Error Code | Error Message | Description |
|---|---|---|
| 401 | Unauthorized | Missing or invalid bearer token. |
| 422 | Buy voucher disabled | Voucher purchase is currently disabled. |
| 422 | User is blocked | The user account is blocked. Please check the “translation” field for more details (e.g., "server_error.sender_account_is_blocked"). |
| 422 | Wallet from not exists | The source wallet (wallet_from) does not exist or is inactive (e.g., deleted or in status NEW) or Insufficient balance. |
| 422 | Only USD wallet allowed | Only USD wallets are allowed for voucher purchase. |
| 422 | Min amount | Minimum amount constraint violated for voucher_amount. |
| 422 | Max amount | Maximum amount constraint violated for voucher_amount. |
is_blocked = 0)max_voucher_amount from application limits
Security Note: Store the voucher code securely. Anyone with access to the voucher code can activate the voucher and claim the funds.