Skip to content
Logo MoneyGo

Buy Confirm

This 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.

  • Method: POST
  • URL: https://api.money-go.com/api/vouchers/buy/confirm
  • Headers:
  • Authorization: Bearer YOUR_ACCESS_TOKEN
  • Content-Type: application/json


The following JSON body must be sent with the POST request:

{
"voucher_amount": 100.00,
"wallet_from": "U123456",
"additional": "Payment reference #12345"
}
FieldTypeRequiredDescription
voucher_amountnumberYesThe desired voucher amount in USD.
wallet_fromstringYesYour USD wallet number from which funds will be debited.
additionalstringNoOptional additional information or payment reference.
Terminal window
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"
}'
{
"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"
}
FieldTypeDescription
voucher_numberstringUnique voucher number (internal ID).
voucher_codestringVoucher activation code (32-character encrypted code).
voucher_amountnumberThe voucher amount (rounded according to ISO mathematical rules)
voucher_currencystringThe voucher currency (always “USD”).
fee_percentnumberThe commission percentage charged by MoneyGo.
wallet_amountnumberTotal amount debited from wallet (voucher + commission).
wallet_currencystringThe currency of the wallet (should match voucher currency).
statusnumberVoucher status (0 = awaiting activation, 1 = activated, 2 = expired, 3 = cancelled).
date_createdstringISO 8601 timestamp when the voucher was created.
expired_atstringISO 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 CodeError MessageDescription
401UnauthorizedMissing or invalid bearer token.
422Buy voucher disabledVoucher purchase is currently disabled.
422User is blockedThe user account is blocked. Please check the “translation” field for more details (e.g., "server_error.sender_account_is_blocked").
422Wallet from not existsThe source wallet (wallet_from) does not exist or is inactive (e.g., deleted or in status NEW) or Insufficient balance.
422Only USD wallet allowedOnly USD wallets are allowed for voucher purchase.
422Min amountMinimum amount constraint violated for voucher_amount.
422Max amountMaximum amount constraint violated for voucher_amount.
  1. Bearer Token Validation: Valid access token is required
  2. User Status: User must not be blocked (is_blocked = 0)
  3. Wallet Ownership: The specified wallet must belong to the authenticated user
  4. Currency Restriction: Only USD wallets are allowed for voucher purchases
  5. Balance Check: Wallet must have sufficient funds to cover voucher amount plus commission
  6. Amount Limits: Voucher amount must be within minimum and maximum limits for the currency
  7. Maximum Voucher Limit: Must not exceed the max_voucher_amount from application limits
  • 0 - Awaiting activation (newly created)
  • 1 - Activated (voucher has been redeemed)
  • 2 - Expired (90-day validity period elapsed)
  • 3 - Cancelled (manually cancelled)
  • Vouchers automatically expire after 90 days
  • System runs hourly checks to update expired vouchers
  • Expired vouchers cannot be activated

Security Note: Store the voucher code securely. Anyone with access to the voucher code can activate the voucher and claim the funds.