Expirer une Transaction de Paiement
curl --request POST \
--url https://sandbox.fapshi.com/expire-pay \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--header 'apiuser: <api-key>' \
--data '
{
"transId": "<string>"
}
'const options = {
method: 'POST',
headers: {apiuser: '<api-key>', apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({transId: '<string>'})
};
fetch('https://sandbox.fapshi.com/expire-pay', 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.fapshi.com/expire-pay",
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([
'transId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>",
"apiuser: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://sandbox.fapshi.com/expire-pay"
payload = { "transId": "<string>" }
headers = {
"apiuser": "<api-key>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://sandbox.fapshi.com/expire-pay")
.header("apiuser", "<api-key>")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transId\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.fapshi.com/expire-pay"
payload := strings.NewReader("{\n \"transId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiuser", "<api-key>")
req.Header.Add("apikey", "<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))
}{
"transId": "<string>",
"status": "CREATED",
"medium": "mobile money",
"serviceName": "<string>",
"transType": "Collection",
"amount": 123,
"revenue": 123,
"payerName": "<string>",
"email": "jsmith@example.com",
"redirectUrl": "<string>",
"externalId": "<string>",
"userId": "<string>",
"webhook": "<string>",
"reason": "<string>",
"financialTransId": "<string>",
"dateInitiated": "2023-12-25",
"dateConfirmed": "2023-12-25"
}{
"message": "<string>"
}Points de terminaison
Expirer une transaction de paiement
Expirer un lien de paiement pour empêcher tout paiement ultérieur.
POST
/
expire-pay
Expirer une Transaction de Paiement
curl --request POST \
--url https://sandbox.fapshi.com/expire-pay \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--header 'apiuser: <api-key>' \
--data '
{
"transId": "<string>"
}
'const options = {
method: 'POST',
headers: {apiuser: '<api-key>', apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({transId: '<string>'})
};
fetch('https://sandbox.fapshi.com/expire-pay', 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.fapshi.com/expire-pay",
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([
'transId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>",
"apiuser: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://sandbox.fapshi.com/expire-pay"
payload = { "transId": "<string>" }
headers = {
"apiuser": "<api-key>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://sandbox.fapshi.com/expire-pay")
.header("apiuser", "<api-key>")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transId\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.fapshi.com/expire-pay"
payload := strings.NewReader("{\n \"transId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiuser", "<api-key>")
req.Header.Add("apikey", "<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))
}{
"transId": "<string>",
"status": "CREATED",
"medium": "mobile money",
"serviceName": "<string>",
"transType": "Collection",
"amount": 123,
"revenue": 123,
"payerName": "<string>",
"email": "jsmith@example.com",
"redirectUrl": "<string>",
"externalId": "<string>",
"userId": "<string>",
"webhook": "<string>",
"reason": "<string>",
"financialTransId": "<string>",
"dateInitiated": "2023-12-25",
"dateConfirmed": "2023-12-25"
}{
"message": "<string>"
}Endpoint
POST /expire-pay
Expire un lien de paiement pour empêcher tout paiement ultérieur.
Seules les transactions créées avec l’endpoint initiate-pay peuvent être expirées.
Paramètres
| Nom | Obligatoire | Type | Description |
|---|---|---|---|
| transId | Oui | chaîne | ID de la transaction à expirer |
Réponse
- Retourne les détails de la transaction expirée si l’opération réussit.
- Retourne un
400 Bad Requestavec le message"Link already expired"si la transaction était déjà expirée.
Réponse
Lien de paiement expiré avec succès