Relancer un paiement échoué
curl --request POST \
--url https://api.alphapay.me/api/v1/payments/{payment_id}/retry/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"methods": [
"moov_bj"
]
}
'import requests
url = "https://api.alphapay.me/api/v1/payments/{payment_id}/retry/"
payload = { "methods": ["moov_bj"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({methods: ['moov_bj']})
};
fetch('https://api.alphapay.me/api/v1/payments/{payment_id}/retry/', 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.alphapay.me/api/v1/payments/{payment_id}/retry/",
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([
'methods' => [
'moov_bj'
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alphapay.me/api/v1/payments/{payment_id}/retry/"
payload := strings.NewReader("{\n \"methods\": [\n \"moov_bj\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.alphapay.me/api/v1/payments/{payment_id}/retry/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"methods\": [\n \"moov_bj\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alphapay.me/api/v1/payments/{payment_id}/retry/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"methods\": [\n \"moov_bj\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Payment retried successfully",
"id": "9c3f2a10-4b7e-4f1a-9d2e-9b6a7c1e4a02",
"checkout_url": ""
}{
"message": "Seuls les paiements (INBOUND) sont réessayables via cet endpoint.",
"code": "invalid_flow"
}{
"message": "Transaction introuvable.",
"code": "not_found"
}{
"message": "Transaction déjà 'SUCCESS', non réessayable.",
"code": "not_retryable"
}{
"message": "Réseau inconnu ou inactif : 'moov_xx'.",
"code": "invalid_method"
}Encaisser
Relancer un paiement échoué
Rejoue le routage sur la même transaction, sans en créer une nouvelle
POST
/
payments
/
{payment_id}
/
retry
/
Relancer un paiement échoué
curl --request POST \
--url https://api.alphapay.me/api/v1/payments/{payment_id}/retry/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"methods": [
"moov_bj"
]
}
'import requests
url = "https://api.alphapay.me/api/v1/payments/{payment_id}/retry/"
payload = { "methods": ["moov_bj"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({methods: ['moov_bj']})
};
fetch('https://api.alphapay.me/api/v1/payments/{payment_id}/retry/', 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.alphapay.me/api/v1/payments/{payment_id}/retry/",
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([
'methods' => [
'moov_bj'
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alphapay.me/api/v1/payments/{payment_id}/retry/"
payload := strings.NewReader("{\n \"methods\": [\n \"moov_bj\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.alphapay.me/api/v1/payments/{payment_id}/retry/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"methods\": [\n \"moov_bj\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alphapay.me/api/v1/payments/{payment_id}/retry/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"methods\": [\n \"moov_bj\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Payment retried successfully",
"id": "9c3f2a10-4b7e-4f1a-9d2e-9b6a7c1e4a02",
"checkout_url": ""
}{
"message": "Seuls les paiements (INBOUND) sont réessayables via cet endpoint.",
"code": "invalid_flow"
}{
"message": "Transaction introuvable.",
"code": "not_found"
}{
"message": "Transaction déjà 'SUCCESS', non réessayable.",
"code": "not_retryable"
}{
"message": "Réseau inconnu ou inactif : 'moov_xx'.",
"code": "invalid_method"
}Réutilise le même
id de transaction — aucune nouvelle transaction n’est créée. Réservé aux paiements entrants (flow_direction: "INBOUND") ; un payout renvoie 400 invalid_flow.Éviter un doublon en cas de coupure réseau
Le headerIdempotency-Key est optionnel : sans lui, chaque appel relance le paiement — un simple retry réseau le relance donc une seconde fois. Avec lui, renvoyer la même clé après un timeout vous renvoie la réponse d’origine au lieu de rejouer l’opération.
Un timeout n’est jamais la preuve qu’une requête a échoué : elle a pu aboutir côté serveur. C’est précisément ce cas que la clé couvre.
curl -X POST https://api.alphapay.me/api/v1/payments/{payment_id}/retry/ \
-H "Authorization: Bearer sk_live_..." \
-H "Idempotency-Key: 3fa85f64-5717-4562-b3fc-2c963f66afa6" \
-H "Content-Type: application/json" \
-d '{ ... }'
409. Détails : Idempotence.Authorizations
Clé API secrète du marchand — header Authorization: Bearer sk_live_xxx (ou sk_test_xxx en environnement de test).
Headers
Identifiant unique que vous générez pour cette tentative (un UUID par exemple). Optionnel : sans lui, chaque appel est traité comme une nouvelle demande. Avec lui, si vous renvoyez la même clé — après un timeout ou une coupure réseau — AlphaPay renvoie la réponse d'origine au lieu de créer un second paiement. Réutilisez la même clé pour les retrys d'une même tentative, changez-en pour toute nouvelle intention. La même clé avec un corps de requête différent renvoie une erreur 409. Voir Idempotence.
Maximum string length:
255Path Parameters
Body
application/json
Response
Paiement relancé (même id de transaction)