Ouvrir l'espace client
curl --request POST \
--url https://mercy-pay.com/api/v1/billing_portal/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_email": "awa@example.com",
"return_url": "https://boutique.example.com/mon-compte"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mercy-pay.com/api/v1/billing_portal/sessions",
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([
'customer_email' => 'awa@example.com',
'return_url' => 'https://boutique.example.com/mon-compte'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_email: 'awa@example.com',
return_url: 'https://boutique.example.com/mon-compte'
})
};
fetch('https://mercy-pay.com/api/v1/billing_portal/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://mercy-pay.com/api/v1/billing_portal/sessions"
payload = {
"customer_email": "awa@example.com",
"return_url": "https://boutique.example.com/mon-compte"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"url": "https://mercy-pay.com/facturation/Xk9pL2mQ7vR4sT8wY1zA3bC6dE0fG5hJ2kL7mN4pQ9rS1tU",
"expires_at": "2026-11-07T11:00:00+00:00"
}{
"error": {
"type": "authentication_error",
"code": "api_key_invalid",
"message": "Clé API invalide.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#api_key_invalid",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}{
"error": {
"type": "authentication_error",
"code": "forbidden",
"message": "L'espace client est désactivé pour ce compte.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#forbidden",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "Aucun abonnement pour ce client.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#resource_not_found",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "Le champ amount est obligatoire.",
"param": "amount",
"doc_url": "https://docs.mercy-pay.com/developers/errors#validation_failed",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab",
"errors": {
"amount": [
"Le champ amount est obligatoire."
]
}
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Trop de requêtes.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#rate_limited",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}Ouvrir l'espace client
Crée un accès d’une heure à l’espace client d’un de vos abonnés. Redirigez-le tout de suite vers url, sans la stocker.
POST
/
api
/
v1
/
billing_portal
/
sessions
Ouvrir l'espace client
curl --request POST \
--url https://mercy-pay.com/api/v1/billing_portal/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_email": "awa@example.com",
"return_url": "https://boutique.example.com/mon-compte"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mercy-pay.com/api/v1/billing_portal/sessions",
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([
'customer_email' => 'awa@example.com',
'return_url' => 'https://boutique.example.com/mon-compte'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_email: 'awa@example.com',
return_url: 'https://boutique.example.com/mon-compte'
})
};
fetch('https://mercy-pay.com/api/v1/billing_portal/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://mercy-pay.com/api/v1/billing_portal/sessions"
payload = {
"customer_email": "awa@example.com",
"return_url": "https://boutique.example.com/mon-compte"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"url": "https://mercy-pay.com/facturation/Xk9pL2mQ7vR4sT8wY1zA3bC6dE0fG5hJ2kL7mN4pQ9rS1tU",
"expires_at": "2026-11-07T11:00:00+00:00"
}{
"error": {
"type": "authentication_error",
"code": "api_key_invalid",
"message": "Clé API invalide.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#api_key_invalid",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}{
"error": {
"type": "authentication_error",
"code": "forbidden",
"message": "L'espace client est désactivé pour ce compte.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#forbidden",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "Aucun abonnement pour ce client.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#resource_not_found",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "Le champ amount est obligatoire.",
"param": "amount",
"doc_url": "https://docs.mercy-pay.com/developers/errors#validation_failed",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab",
"errors": {
"amount": [
"Le champ amount est obligatoire."
]
}
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Trop de requêtes.",
"param": null,
"doc_url": "https://docs.mercy-pay.com/developers/errors#rate_limited",
"request_id": "req_01jc8x4m2v7t9qk3n5w6y8z0ab"
}
}À ouvrir depuis un bouton « Gérer mon abonnement » de votre site. Voir Espace client pour ce que votre abonné y fait.
Authorizations
Body
application/json