curl --request POST \
--url https://api.example.com/instant-payment/accounts/{accountType}/aliases \
--header 'ApiKey: <apikey>' \
--header 'Environment: <environment>' \
--header 'MerchantId: <merchantid>'import requests
url = "https://api.example.com/instant-payment/accounts/{accountType}/aliases"
headers = {
"ApiKey": "<apikey>",
"MerchantId": "<merchantid>",
"Environment": "<environment>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {ApiKey: '<apikey>', MerchantId: '<merchantid>', Environment: '<environment>'}
};
fetch('https://api.example.com/instant-payment/accounts/{accountType}/aliases', 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://api.example.com/instant-payment/accounts/{accountType}/aliases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"ApiKey: <apikey>",
"Environment: <environment>",
"MerchantId: <merchantid>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/instant-payment/accounts/{accountType}/aliases"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("ApiKey", "<apikey>")
req.Header.Add("MerchantId", "<merchantid>")
req.Header.Add("Environment", "<environment>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/instant-payment/accounts/{accountType}/aliases")
.header("ApiKey", "<apikey>")
.header("MerchantId", "<merchantid>")
.header("Environment", "<environment>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/instant-payment/accounts/{accountType}/aliases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ApiKey"] = '<apikey>'
request["MerchantId"] = '<merchantid>'
request["Environment"] = '<environment>'
response = http.request(request)
puts response.read_body{
"aliasKey": "b9a4c2e1-7f3d-4e5a-9c8b-1d2e3f4a5b6c",
"aliasType": "SHID",
"accountType": "collection",
"isPrimary": true,
"created": true
}{
"status": 400,
"error": {
"statusCode": 400,
"message": [
"destination.provider must be a string"
],
"error": "Bad Request"
}
}{
"status": 401,
"error": {
"type": "authorization_error",
"code": "wrong_credentials",
"message": "L'ID marchand et/ou la clé d'API sont incorrects."
}
}{
"status": 403,
"error": {
"statusCode": 403,
"message": "Forbidden",
"error": "<string>"
}
}{
"httpStatus": 409,
"type": "invalid_request",
"code": "unsupported_action",
"message": "This action is not supported"
}{
"status": 422,
"error": "Unable to process this transaction"
}{
"status": 429,
"error": "ThrottlerException: Too Many Requests"
}{
"type": "internal_error",
"code": [
"internal_error",
"wrong_credentials",
"not_granted",
"live_mode_not_granted"
],
"message": "An error occurred on our system. Please try again later."
}{
"status": 503,
"code": "merchant_group_unavailable",
"message": "Your merchant group could not be verified. Please retry in a few moments.",
"request_id": "<string>"
}{
"status": 503,
"code": "merchant_group_unavailable",
"message": "Your merchant group could not be verified. Please retry in a few moments.",
"request_id": "<string>"
}Create an instant payment alias
Registers a SHID alias for one of your accounts in the BCEAO instant payment directory. The directory generates the alias key. An account holds one SHID alias: if it already has one, that alias is returned with created set to false. Inside a merchant group the aliases are the group owner’s and are managed by its sub-merchants: the owner calling under its own id is refused (403 group_owner_transaction_forbidden). Live mode only.
curl --request POST \
--url https://api.example.com/instant-payment/accounts/{accountType}/aliases \
--header 'ApiKey: <apikey>' \
--header 'Environment: <environment>' \
--header 'MerchantId: <merchantid>'import requests
url = "https://api.example.com/instant-payment/accounts/{accountType}/aliases"
headers = {
"ApiKey": "<apikey>",
"MerchantId": "<merchantid>",
"Environment": "<environment>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {ApiKey: '<apikey>', MerchantId: '<merchantid>', Environment: '<environment>'}
};
fetch('https://api.example.com/instant-payment/accounts/{accountType}/aliases', 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://api.example.com/instant-payment/accounts/{accountType}/aliases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"ApiKey: <apikey>",
"Environment: <environment>",
"MerchantId: <merchantid>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/instant-payment/accounts/{accountType}/aliases"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("ApiKey", "<apikey>")
req.Header.Add("MerchantId", "<merchantid>")
req.Header.Add("Environment", "<environment>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/instant-payment/accounts/{accountType}/aliases")
.header("ApiKey", "<apikey>")
.header("MerchantId", "<merchantid>")
.header("Environment", "<environment>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/instant-payment/accounts/{accountType}/aliases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ApiKey"] = '<apikey>'
request["MerchantId"] = '<merchantid>'
request["Environment"] = '<environment>'
response = http.request(request)
puts response.read_body{
"aliasKey": "b9a4c2e1-7f3d-4e5a-9c8b-1d2e3f4a5b6c",
"aliasType": "SHID",
"accountType": "collection",
"isPrimary": true,
"created": true
}{
"status": 400,
"error": {
"statusCode": 400,
"message": [
"destination.provider must be a string"
],
"error": "Bad Request"
}
}{
"status": 401,
"error": {
"type": "authorization_error",
"code": "wrong_credentials",
"message": "L'ID marchand et/ou la clé d'API sont incorrects."
}
}{
"status": 403,
"error": {
"statusCode": 403,
"message": "Forbidden",
"error": "<string>"
}
}{
"httpStatus": 409,
"type": "invalid_request",
"code": "unsupported_action",
"message": "This action is not supported"
}{
"status": 422,
"error": "Unable to process this transaction"
}{
"status": 429,
"error": "ThrottlerException: Too Many Requests"
}{
"type": "internal_error",
"code": [
"internal_error",
"wrong_credentials",
"not_granted",
"live_mode_not_granted"
],
"message": "An error occurred on our system. Please try again later."
}{
"status": 503,
"code": "merchant_group_unavailable",
"message": "Your merchant group could not be verified. Please retry in a few moments.",
"request_id": "<string>"
}{
"status": 503,
"code": "merchant_group_unavailable",
"message": "Your merchant group could not be verified. Please retry in a few moments.",
"request_id": "<string>"
}Headers
Your api key. To create a key, please get into our dashboard. If you don't have access to it, please reach the Support team.
Your merchant ID. This information is available in our dashboard. If you don't have access to it, please reach the Support team.
Allow you to choose between the sandbox mode to perform some tests or the live mode for real world transactions.
live, sandbox Path Parameters
The account the aliases belong to: collection (receives instant payments) or transfer (pays them out)
collection, transfer "collection"
Response
The alias key: the payment address to publish so payers can reach this account
"b9a4c2e1-7f3d-4e5a-9c8b-1d2e3f4a5b6c"
The alias type. HUB2 creates SHID aliases, whose key the directory generates
SHID, MCOD, MBNO The account the alias names
collection, transfer Whether HUB2 uses this alias as the account's own leg on the payments it initiates
False when the account already held a SHID alias: the directory holds one SHID per account and returns the existing one rather than creating a second
