Calculer les frais de transaction
curl --request POST \
--url https://api.mysoleas.com/transactions/fees/quote \
--header 'Content-Type: application/json' \
--header 'x-sp-auth-token: <api-key>' \
--data '
{
"amount": 10000,
"currency": "XAF",
"serviceId": 1,
"service_id": 1,
"provider": "mtn_cmr",
"origin": "APPLICATION",
"plugin": "CHECKOUT",
"feeBearer": "CUSTOMER",
"customerPaysFees": true,
"operation": "COLLECTION",
"amount_unit": "MAJOR"
}
'import requests
url = "https://api.mysoleas.com/transactions/fees/quote"
payload = {
"amount": 10000,
"currency": "XAF",
"serviceId": 1,
"service_id": 1,
"provider": "mtn_cmr",
"origin": "APPLICATION",
"plugin": "CHECKOUT",
"feeBearer": "CUSTOMER",
"customerPaysFees": True,
"operation": "COLLECTION",
"amount_unit": "MAJOR"
}
headers = {
"x-sp-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-sp-auth-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 10000,
currency: 'XAF',
serviceId: 1,
service_id: 1,
provider: 'mtn_cmr',
origin: 'APPLICATION',
plugin: 'CHECKOUT',
feeBearer: 'CUSTOMER',
customerPaysFees: true,
operation: 'COLLECTION',
amount_unit: 'MAJOR'
})
};
fetch('https://api.mysoleas.com/transactions/fees/quote', 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.mysoleas.com/transactions/fees/quote",
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([
'amount' => 10000,
'currency' => 'XAF',
'serviceId' => 1,
'service_id' => 1,
'provider' => 'mtn_cmr',
'origin' => 'APPLICATION',
'plugin' => 'CHECKOUT',
'feeBearer' => 'CUSTOMER',
'customerPaysFees' => true,
'operation' => 'COLLECTION',
'amount_unit' => 'MAJOR'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-sp-auth-token: <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://api.mysoleas.com/transactions/fees/quote"
payload := strings.NewReader("{\n \"amount\": 10000,\n \"currency\": \"XAF\",\n \"serviceId\": 1,\n \"service_id\": 1,\n \"provider\": \"mtn_cmr\",\n \"origin\": \"APPLICATION\",\n \"plugin\": \"CHECKOUT\",\n \"feeBearer\": \"CUSTOMER\",\n \"customerPaysFees\": true,\n \"operation\": \"COLLECTION\",\n \"amount_unit\": \"MAJOR\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-sp-auth-token", "<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://api.mysoleas.com/transactions/fees/quote")
.header("x-sp-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10000,\n \"currency\": \"XAF\",\n \"serviceId\": 1,\n \"service_id\": 1,\n \"provider\": \"mtn_cmr\",\n \"origin\": \"APPLICATION\",\n \"plugin\": \"CHECKOUT\",\n \"feeBearer\": \"CUSTOMER\",\n \"customerPaysFees\": true,\n \"operation\": \"COLLECTION\",\n \"amount_unit\": \"MAJOR\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mysoleas.com/transactions/fees/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-sp-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 10000,\n \"currency\": \"XAF\",\n \"serviceId\": 1,\n \"service_id\": 1,\n \"provider\": \"mtn_cmr\",\n \"origin\": \"APPLICATION\",\n \"plugin\": \"CHECKOUT\",\n \"feeBearer\": \"CUSTOMER\",\n \"customerPaysFees\": true,\n \"operation\": \"COLLECTION\",\n \"amount_unit\": \"MAJOR\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"success": true,
"data": {
"baseAmount": 10000,
"feeAmount": 350,
"payableAmount": 10350,
"merchantNetAmount": 9650,
"currency": "XAF",
"feeBearer": "CUSTOMER",
"countryCode": "CMR",
"userTier": 5,
"source": "APPLICATION_CONFIGURATION"
},
"locale": "fr",
"message": "fees_quote"
}Collections
Devis des frais de transaction
Calculer le montant des frais, le montant payable et le porteur des frais avant une transaction.
POST
/
transactions
/
fees
/
quote
Calculer les frais de transaction
curl --request POST \
--url https://api.mysoleas.com/transactions/fees/quote \
--header 'Content-Type: application/json' \
--header 'x-sp-auth-token: <api-key>' \
--data '
{
"amount": 10000,
"currency": "XAF",
"serviceId": 1,
"service_id": 1,
"provider": "mtn_cmr",
"origin": "APPLICATION",
"plugin": "CHECKOUT",
"feeBearer": "CUSTOMER",
"customerPaysFees": true,
"operation": "COLLECTION",
"amount_unit": "MAJOR"
}
'import requests
url = "https://api.mysoleas.com/transactions/fees/quote"
payload = {
"amount": 10000,
"currency": "XAF",
"serviceId": 1,
"service_id": 1,
"provider": "mtn_cmr",
"origin": "APPLICATION",
"plugin": "CHECKOUT",
"feeBearer": "CUSTOMER",
"customerPaysFees": True,
"operation": "COLLECTION",
"amount_unit": "MAJOR"
}
headers = {
"x-sp-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-sp-auth-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 10000,
currency: 'XAF',
serviceId: 1,
service_id: 1,
provider: 'mtn_cmr',
origin: 'APPLICATION',
plugin: 'CHECKOUT',
feeBearer: 'CUSTOMER',
customerPaysFees: true,
operation: 'COLLECTION',
amount_unit: 'MAJOR'
})
};
fetch('https://api.mysoleas.com/transactions/fees/quote', 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.mysoleas.com/transactions/fees/quote",
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([
'amount' => 10000,
'currency' => 'XAF',
'serviceId' => 1,
'service_id' => 1,
'provider' => 'mtn_cmr',
'origin' => 'APPLICATION',
'plugin' => 'CHECKOUT',
'feeBearer' => 'CUSTOMER',
'customerPaysFees' => true,
'operation' => 'COLLECTION',
'amount_unit' => 'MAJOR'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-sp-auth-token: <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://api.mysoleas.com/transactions/fees/quote"
payload := strings.NewReader("{\n \"amount\": 10000,\n \"currency\": \"XAF\",\n \"serviceId\": 1,\n \"service_id\": 1,\n \"provider\": \"mtn_cmr\",\n \"origin\": \"APPLICATION\",\n \"plugin\": \"CHECKOUT\",\n \"feeBearer\": \"CUSTOMER\",\n \"customerPaysFees\": true,\n \"operation\": \"COLLECTION\",\n \"amount_unit\": \"MAJOR\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-sp-auth-token", "<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://api.mysoleas.com/transactions/fees/quote")
.header("x-sp-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10000,\n \"currency\": \"XAF\",\n \"serviceId\": 1,\n \"service_id\": 1,\n \"provider\": \"mtn_cmr\",\n \"origin\": \"APPLICATION\",\n \"plugin\": \"CHECKOUT\",\n \"feeBearer\": \"CUSTOMER\",\n \"customerPaysFees\": true,\n \"operation\": \"COLLECTION\",\n \"amount_unit\": \"MAJOR\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mysoleas.com/transactions/fees/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-sp-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 10000,\n \"currency\": \"XAF\",\n \"serviceId\": 1,\n \"service_id\": 1,\n \"provider\": \"mtn_cmr\",\n \"origin\": \"APPLICATION\",\n \"plugin\": \"CHECKOUT\",\n \"feeBearer\": \"CUSTOMER\",\n \"customerPaysFees\": true,\n \"operation\": \"COLLECTION\",\n \"amount_unit\": \"MAJOR\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"success": true,
"data": {
"baseAmount": 10000,
"feeAmount": 350,
"payableAmount": 10350,
"merchantNetAmount": 9650,
"currency": "XAF",
"feeBearer": "CUSTOMER",
"countryCode": "CMR",
"userTier": 5,
"source": "APPLICATION_CONFIGURATION"
},
"locale": "fr",
"message": "fees_quote"
}Cette route calcule les frais cote serveur avant de lancer une collection ou un disbursement.
Vous pouvez identifier le service avec
Lorsque
serviceId, service_id, provider, serviceCode ou service_code.
Pour une application API directe, le porteur des frais vient de la configuration de l’application authentifiee ou du header interne X-SP-Fee-Bearer.
Pour un plugin, envoyez origin: "PLUGIN" et fournissez feeBearer dans le payload ou dans la query string. Le payload est prioritaire.
| Champ | Role |
|---|---|
amount | Montant de base a facturer |
amount_unit | Champ JSON facultatif à la racine : MAJOR par défaut, ou MINOR pour des centimes entiers USD/EUR |
currency | Devise attendue par le service |
operation | COLLECTION par defaut, ou DISBURSEMENT |
provider | Code service, par exemple mtn_cmr |
origin | APPLICATION par defaut, ou PLUGIN |
feeBearer | CUSTOMER ou MERCHANT |
feeBearer vaut CUSTOMER, payableAmount inclut les frais. Lorsque feeBearer vaut MERCHANT, merchantNetAmount indique le montant net marchand apres frais.
Envoyez amount en valeur réelle par défaut : 4.01 pour 4,01 USD/EUR. Les clients API qui envoient déjà des centimes peuvent préciser amount_unit: "MINOR" à la racine du corps JSON, au même niveau que amount et currency, et non dans metadata. Les réponses publiques reviennent en valeur réelle même si la requête utilise MINOR. Consultez les montants et devises.
baseAmount, feeAmount, payableAmount et merchantNetAmount sont retournés en valeur réelle. Conservez leurs décimales pour les afficher ou les comparer.Autorisations
Token Bearer obtenu avec le client_id et le client_secret de l'application creee dans SoleasPay. Format: Bearer <access_token>.
Paramètres de requête
Prioritaire seulement pour les flux plugin lorsque le payload ne fournit pas feeBearer.
Options disponibles:
CUSTOMER, MERCHANT Corps
application/json
Montant en valeur réelle par défaut : 4.01 pour 4,01 USD/EUR. Avec amount_unit MINOR à la racine, envoyez des centimes entiers (401).
Exemple:
10000
Exemple:
"XAF"
Exemple:
1
Exemple:
1
Exemple:
"mtn_cmr"
Options disponibles:
APPLICATION, PLUGIN Exemple:
"APPLICATION"
Exemple:
"CHECKOUT"
Options disponibles:
CUSTOMER, MERCHANT Exemple:
"CUSTOMER"
Exemple:
true
Options disponibles:
COLLECTION, DISBURSEMENT Exemple:
"COLLECTION"
Unité des montants de la requête. Facultatif, MAJOR par défaut. Placez ce champ à la racine du corps JSON, pas dans metadata. MINOR conserve les montants déjà exprimés dans la plus petite unité.
Options disponibles:
MAJOR, MINOR Exemple:
"MAJOR"
⌘I
