const paymentMethod = await afriex.paymentMethods.create({
channel: "BANK_ACCOUNT",
customerId: "customer-id",
accountName: "John Doe",
accountNumber: "1234567890",
countryCode: "NG",
institution: {
institutionCode: "044",
institutionName: "Access Bank",
},
});curl --request POST \
--url https://sandbox.api.afriex.com/api/v1/payment-method \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"customerId": "69528240ba52c13b669fb239",
"type": "WITHDRAW",
"channel": "BANK_ACCOUNT",
"accountName": "John Doe",
"accountNumber": "0123456789",
"countryCode": "NG",
"institution": {
"institutionCode": "058",
"institutionName": "GTBank"
}
}
'import requests
url = "https://sandbox.api.afriex.com/api/v1/payment-method"
payload = {
"customerId": "69528240ba52c13b669fb239",
"type": "WITHDRAW",
"channel": "BANK_ACCOUNT",
"accountName": "John Doe",
"accountNumber": "0123456789",
"countryCode": "NG",
"institution": {
"institutionCode": "058",
"institutionName": "GTBank"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerId: '69528240ba52c13b669fb239',
type: 'WITHDRAW',
channel: 'BANK_ACCOUNT',
accountName: 'John Doe',
accountNumber: '0123456789',
countryCode: 'NG',
institution: {institutionCode: '058', institutionName: 'GTBank'}
})
};
fetch('https://sandbox.api.afriex.com/api/v1/payment-method', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.api.afriex.com/api/v1/payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customerId' => '69528240ba52c13b669fb239',
'type' => 'WITHDRAW',
'channel' => 'BANK_ACCOUNT',
'accountName' => 'John Doe',
'accountNumber' => '0123456789',
'countryCode' => 'NG',
'institution' => [
'institutionCode' => '058',
'institutionName' => 'GTBank'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.api.afriex.com/api/v1/payment-method"
payload := strings.NewReader("{\n \"customerId\": \"69528240ba52c13b669fb239\",\n \"type\": \"WITHDRAW\",\n \"channel\": \"BANK_ACCOUNT\",\n \"accountName\": \"John Doe\",\n \"accountNumber\": \"0123456789\",\n \"countryCode\": \"NG\",\n \"institution\": {\n \"institutionCode\": \"058\",\n \"institutionName\": \"GTBank\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.api.afriex.com/api/v1/payment-method")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"69528240ba52c13b669fb239\",\n \"type\": \"WITHDRAW\",\n \"channel\": \"BANK_ACCOUNT\",\n \"accountName\": \"John Doe\",\n \"accountNumber\": \"0123456789\",\n \"countryCode\": \"NG\",\n \"institution\": {\n \"institutionCode\": \"058\",\n \"institutionName\": \"GTBank\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.afriex.com/api/v1/payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"69528240ba52c13b669fb239\",\n \"type\": \"WITHDRAW\",\n \"channel\": \"BANK_ACCOUNT\",\n \"accountName\": \"John Doe\",\n \"accountNumber\": \"0123456789\",\n \"countryCode\": \"NG\",\n \"institution\": {\n \"institutionCode\": \"058\",\n \"institutionName\": \"GTBank\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"paymentMethodId": "69d6002579101baa20f63816",
"channel": "BANK_ACCOUNT",
"customerId": "69d60024ab82306f11b03325",
"institution": {
"institutionCode": "000013",
"institutionName": "GTBank"
},
"accountName": "John Doe",
"accountNumber": "0123456789",
"countryCode": "NG"
}
}Create Payment Method
Creates a new payment method.
const paymentMethod = await afriex.paymentMethods.create({
channel: "BANK_ACCOUNT",
customerId: "customer-id",
accountName: "John Doe",
accountNumber: "1234567890",
countryCode: "NG",
institution: {
institutionCode: "044",
institutionName: "Access Bank",
},
});curl --request POST \
--url https://sandbox.api.afriex.com/api/v1/payment-method \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"customerId": "69528240ba52c13b669fb239",
"type": "WITHDRAW",
"channel": "BANK_ACCOUNT",
"accountName": "John Doe",
"accountNumber": "0123456789",
"countryCode": "NG",
"institution": {
"institutionCode": "058",
"institutionName": "GTBank"
}
}
'import requests
url = "https://sandbox.api.afriex.com/api/v1/payment-method"
payload = {
"customerId": "69528240ba52c13b669fb239",
"type": "WITHDRAW",
"channel": "BANK_ACCOUNT",
"accountName": "John Doe",
"accountNumber": "0123456789",
"countryCode": "NG",
"institution": {
"institutionCode": "058",
"institutionName": "GTBank"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerId: '69528240ba52c13b669fb239',
type: 'WITHDRAW',
channel: 'BANK_ACCOUNT',
accountName: 'John Doe',
accountNumber: '0123456789',
countryCode: 'NG',
institution: {institutionCode: '058', institutionName: 'GTBank'}
})
};
fetch('https://sandbox.api.afriex.com/api/v1/payment-method', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.api.afriex.com/api/v1/payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customerId' => '69528240ba52c13b669fb239',
'type' => 'WITHDRAW',
'channel' => 'BANK_ACCOUNT',
'accountName' => 'John Doe',
'accountNumber' => '0123456789',
'countryCode' => 'NG',
'institution' => [
'institutionCode' => '058',
'institutionName' => 'GTBank'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.api.afriex.com/api/v1/payment-method"
payload := strings.NewReader("{\n \"customerId\": \"69528240ba52c13b669fb239\",\n \"type\": \"WITHDRAW\",\n \"channel\": \"BANK_ACCOUNT\",\n \"accountName\": \"John Doe\",\n \"accountNumber\": \"0123456789\",\n \"countryCode\": \"NG\",\n \"institution\": {\n \"institutionCode\": \"058\",\n \"institutionName\": \"GTBank\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.api.afriex.com/api/v1/payment-method")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"69528240ba52c13b669fb239\",\n \"type\": \"WITHDRAW\",\n \"channel\": \"BANK_ACCOUNT\",\n \"accountName\": \"John Doe\",\n \"accountNumber\": \"0123456789\",\n \"countryCode\": \"NG\",\n \"institution\": {\n \"institutionCode\": \"058\",\n \"institutionName\": \"GTBank\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.afriex.com/api/v1/payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"69528240ba52c13b669fb239\",\n \"type\": \"WITHDRAW\",\n \"channel\": \"BANK_ACCOUNT\",\n \"accountName\": \"John Doe\",\n \"accountNumber\": \"0123456789\",\n \"countryCode\": \"NG\",\n \"institution\": {\n \"institutionCode\": \"058\",\n \"institutionName\": \"GTBank\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"paymentMethodId": "69d6002579101baa20f63816",
"channel": "BANK_ACCOUNT",
"customerId": "69d60024ab82306f11b03325",
"institution": {
"institutionCode": "000013",
"institutionName": "GTBank"
},
"accountName": "John Doe",
"accountNumber": "0123456789",
"countryCode": "NG"
}
}Please note that fields without values are not included in the response. This includes fields with empty strings, null values, and undefined values.
accountName character rules. For every channel except WE_CHAT and ALIPAY, the account holder’s name must use Latin-script letters (A-Z / a-z, including accented forms such as é, ñ, ü, ç) or Chinese (Han) characters, digits (0-9), spaces, and the characters &, (, ), +, ,, -, ., /, :, ?, and apostrophe ('). At least one letter is required. Names in other scripts (e.g. Arabic, Cyrillic) or containing other symbols are rejected. For WE_CHAT and ALIPAY payouts, submit the beneficiary’s local-script name (e.g. Chinese characters) as it appears on their wallet.Authorizations
Static business API key issued from the dashboard. A business can provision multiple API keys, each scoped to a configurable set of permissions (e.g. read transactions, create deposits, etc). Permissions are chosen per key at creation time in the dashboard and may be revoked by deleting the key. Requests made with a key that does not include the permission required by the target endpoint is rejected with a 401 Unauthorized response, the same response an unrecognised, malformed or revoked key returns. The API does not distinguish the two cases on the wire. Manage your keys and their permissions under Developer → API keys in the dashboard.
Headers
Signature of the request payload, used for request authentication where payload signing is enabled for your business.
API version in ISO 8601 format. The only supported version is 2026-05-18, which is also the default when the header is omitted. Any other value is rejected with a 400 Bad Request.
Body
The payment method channel
BANK_ACCOUNT, MOBILE_MONEY, VIRTUAL_BANK_ACCOUNT, ACH_BANK_ACCOUNT, INTERAC, UPI, SWIFT, WE_CHAT The name of the account holder. Must use Latin-script letters (A-Z / a-z, including accented forms such as é, ñ, ü, ç) or Chinese (Han) characters, digits (0-9), spaces and the characters & ( ) + , - . / : ? and apostrophe; it must contain at least one letter. Names in other scripts (e.g. Arabic, Cyrillic) or containing other symbols are rejected. Exception: China-facing payouts on the WE_CHAT channel (which carries both WeChat and Alipay) accept the beneficiary's local-script (e.g. Chinese) name.
The account number
The ISO 3166-1 alpha-2 country code. This has to be one of the countries we support
The destination institution. For USD (SWIFT) payout payment methods, correspondentBankName and correspondentBankAccountNumber are mandatory.
Show child attributes
Show child attributes
Optional. The customer to attach this payment method to. When omitted, it is attached to the business owner.
The capability of this payment method. DEPOSIT means funds can be pulled from this method (e.g. charge/collect from the customer). WITHDRAW means funds can be sent to this method (e.g. pay out to the customer). If omitted, defaults to WITHDRAW.
DEPOSIT, WITHDRAW Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Payment method created successfully.
A payment method. Empty fields are omitted. Account-shaped channels (BANK_ACCOUNT, MOBILE_MONEY, SWIFT, etc.) populate accountName, accountNumber, and institution; the CARD channel instead populates last4, brand, expiration, and cardName.
Show child attributes
Show child attributes
