Skip to main content

Create FX Trade (New)

Overview

Create an FX trade between all the currency pairs we support. You can convert funds into another wallet or send the converted funds directly to a beneficiary. This API requires a valid vfx_Token obtained from the Get Rates endpoint.

Resource Access

  • HTTP Method: POST
  • Endpoint: /banking/ibans/v2/fx/payments
  • Authentication: Bearer token required

Request Headers

HeaderValueRequiredDescription
Acceptapplication/jsonYesContent type for the response
AuthorizationBearer {access_token}YesBearer token for authentication
Content-Typeapplication/jsonYesRequest body content type
x-api-keystringNoAPI key for additional authentication

Request Body

{
"paymentType": "convertWalletPayout",
"sourceWalletId": 11435,
"sourceAmount": 4800,
"purposeId": 45,
"vfx_Token": "uciebcjdencijwnijnciqnq832982jhbj3eduh3",
"customPaymentReference": "Payment to Jonas computers",
"targetAccountId": 839,
"paymentId": "35448e78-8180-4ce5-8671-772c29ad658f",
"supportingDocS3Key": "",
"sender": {
"country": "NG",
"type": "company",
"name": "Suit Country",
"customerIdentificationNumber": "45jtjy",
"accountNumber": "1234567890",
"address_line_1": "house street",
"address_city": "London",
"origination_country": "US",
"zip_code": "83888",
"registration_country": "NG",
"companyRegistrationNumber": "7575788",
"sub_category": "Baby products"
}
}

Request Fields

FieldTypeRequiredDescription
paymentTypestringYesconvertWalletPayout (to beneficiary) or convertWithinWallets (to wallet)
sourceWalletIdnumberYesWallet ID to deduct funds from
sourceAmountnumberYesAmount to deduct from the source wallet
purposeIdnumberConditionalPurpose code. Required for convertWalletPayout
vfx_TokenstringYesRate token from Get Rates endpoint. Valid for 30 seconds
customPaymentReferencestringNoCustom reference to store for this payment
targetAccountIdnumberConditionalBeneficiary ID. Required for convertWalletPayout
targetWalletIdnumberConditionalWallet ID. Required for convertWithinWallets
paymentIdstring (UUID)YesUnique payment identifier for idempotency
supportingDocS3KeystringNoS3 key for supporting document
senderobjectNoUnderlying sender details for compliance
sender.typestringNoSender type: company or individual
sender.countrystringNoCountry of origin of funds
sender.namestringNoFull name of the sender
sender.dobstringNoDate of birth (individuals only)
sender.nationalitystringNoNationality (individuals only)

Response

Success Response (200 OK)

{
"id": "20088",
"reference": "EN-10052024-015",
"userId": "2289",
"companyId": "2233",
"currencyFrom": "USD",
"amountFrom": 4800,
"currencyTo": "NGN",
"amountTo": 4936560,
"rate": 1028.4456,
"pricing": {
"overageFee": 0,
"usageId": "6660409cc733e0fac55eb97f",
"subscriptionId": "664b3fc0e8e52032427e0b70"
},
"state": "inwardSettlementDone",
"source": "wallet",
"sourceId": 11435,
"target": "account",
"targetId": 32655,
"inwardSettlementTime": "2024-06-05T10:40:44.000Z",
"outwardSettlementTime": null,
"purpose": "Professional fees payment",
"createdAt": "2024-06-05T10:40:29.000Z",
"updatedAt": "2024-06-05T10:40:51.000Z",
"transaction": {
"receiver": {
"accountNumber": "5401662301",
"bankName": "Providus Bank",
"name": "crest",
"bankCode": "000023"
},
"shortURL": "https://pay.Ahrvofx.com/n3hjz2v"
}
}

Response Fields

FieldTypeDescription
idstringUnique trade identifier
referencestringAhrvo unique reference number
currencyFromstringSource currency converted from
amountFromnumberSource amount
currencyTostringTarget currency
amountTonumberTarget amount received
ratenumberExchange rate applied
statestringCurrent state of the trade
sourcestringSource entity type (wallet/account)
targetstringTarget entity type (wallet/account)
inwardSettlementTimestring (date-time)When sender was debited
outwardSettlementTimestring (date-time)When receiver was credited
transaction.receiverobjectReceiver's bank details
transaction.shortURLstringShort URL for the trade

Error Responses

  • 400 Bad Request: Invalid request data
  • 401 Unauthorized: Invalid or missing authentication token
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Beneficiary or wallet not found
  • 500 Internal Server Error: Server error

Code Examples

cURL

curl -X POST \
'https://gateway.ahrvo.network/banking/ibans/v2/fx/payments' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"paymentType": "convertWalletPayout",
"sourceWalletId": 11435,
"sourceAmount": 4800,
"purposeId": 45,
"vfx_Token": "YOUR_VFX_TOKEN",
"targetAccountId": 839,
"paymentId": "35448e78-8180-4ce5-8671-772c29ad658f"
}'

Python

import requests

url = "https://gateway.ahrvo.network/banking/ibans/v2/fx/payments"
headers = {
"Accept": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
data = {
"paymentType": "convertWalletPayout",
"sourceWalletId": 11435,
"sourceAmount": 4800,
"purposeId": 45,
"vfx_Token": "YOUR_VFX_TOKEN",
"targetAccountId": 839,
"paymentId": "35448e78-8180-4ce5-8671-772c29ad658f"
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
print(f"Trade ID: {result['id']}, Reference: {result['reference']}")

JavaScript (Node.js)

const axios = require('axios');

const url = 'https://gateway.ahrvo.network/banking/ibans/v2/fx/payments';
const headers = {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
};
const data = {
paymentType: 'convertWalletPayout',
sourceWalletId: 11435,
sourceAmount: 4800,
purposeId: 45,
vfx_Token: 'YOUR_VFX_TOKEN',
targetAccountId: 839,
paymentId: '35448e78-8180-4ce5-8671-772c29ad658f'
};

axios.post(url, data, { headers })
.then(response => {
console.log('Trade created:', response.data.reference);
})
.catch(error => {
console.error(error.response.data);
});

Usage Notes

  • Always obtain a fresh vfx_Token from Get Rates immediately before creating a trade
  • The vfx_Token expires in 30 seconds — execute the trade within this window
  • Use a unique paymentId (UUID) for each trade to ensure idempotency
  • For convertWalletPayout, both purposeId and targetAccountId are required
  • For convertWithinWallets, targetWalletId is required instead
  • Include sender details for regulatory compliance when required

Payment Type Guide

paymentTypeDescriptionRequired Fields
convertWalletPayoutConvert and send to a beneficiary accountpurposeId, targetAccountId
convertWithinWalletsConvert and move to another wallettargetWalletId

Interactive API Explorer