Passer au contenu principal
POST
/
transactions
/
{mode}
NodeJs
const transaction = await Transaction.create(...);
const token = transaction.generateToken().token;
const mode = 'METHODE_PAIEMENT'; // Exemple : 'mtn', 'moov', 'mtn_ci', 'moov_tg'
const phoneNumber = { // Ce paramètre n'est pas obligatoire
  number: '64000001',
  country: 'bj'
};
await transaction.sendNowWithToken(mode, token, phoneNumber);
$transaction = \FedaPay\Transaction::create(...);
$token = $transaction->generateToken()->token;
$mode = 'METHODE_PAIEMENT'; // Exemple : 'mtn', 'moov', 'mtn_ci', 'moov_tg'
$phoneNumber = [ // Ce paramètre n'est pas obligatoire
    'number' => '64000001',
    'country' => 'bj'
];
$transaction->sendNowWithToken($mode, $token, $phoneNumber);
require 'fedapay'

FedaPay.api_key = 'YOUR_SECRET_API_KEY'
FedaPay.environment = 'sandbox'

transaction = FedaPay::Transaction.create(
  amount: 1000,
  currency: { iso: 'XOF' },
  customer: { id: 1 },
  description: 'Payment for order #1234',
  callback_url: 'https://example.com/callback',
  mode: 'mtn_open'
)

puts "Transaction successfully created: #{transaction.inspect}"
curl --request POST \
  --url https://sandbox-api.fedapay.com/v1/transactions/{mode} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "token": 1,
  "phone_number": {
    "number": "+22997808080",
    "country": "BJ"
  }
}
'
import requests

url = "https://sandbox-api.fedapay.com/v1/transactions/{mode}"

payload = {
    "token": 1,
    "phone_number": {
        "number": "+22997808080",
        "country": "BJ"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox-api.fedapay.com/v1/transactions/{mode}"

	payload := strings.NewReader("{\n  \"token\": 1,\n  \"phone_number\": {\n    \"number\": \"+22997808080\",\n    \"country\": \"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://sandbox-api.fedapay.com/v1/transactions/{mode}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"token\": 1,\n  \"phone_number\": {\n    \"number\": \"+22997808080\",\n    \"country\": \"BJ\"\n  }\n}")
  .asString();
[
  {
    "reference": "pi_xdc_123456",
    "amount": 1000,
    "status": "pending",
    "currency_id": 840,
    "mode": "automatic",
    "last_error_code": "NO_ERROR",
    "created_at": "2024-10-23T14:00:00Z",
    "updated_at": "2024-10-23T14:00:00Z",
    "approved_at": "2024-10-23T14:31:00Z",
    "canceled_at": "2024-10-23T14:32:00Z",
    "deleted_at": "2024-10-23T14:33:00Z",
    "payment_method_id": 1,
    "transaction_key": "TRANSACTION-XYZ",
    "account_id": 5
  }
]

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Paramètres de chemin

mode
string
requis

Transaction mode.

Corps

application/json
token
integer
requis

Transaction token

Exemple:

1

phone_number
object

Phone number details

Réponse

Transaction sent successfully.

reference
string

Payment intent reference.

Exemple:

"pi_xdc_123456"

amount
integer

Payout amount.

Exemple:

1000

status
string

Intent status (e.g., 'pending', 'scheduled', 'sent', 'failed').

Exemple:

"pending"

currency_id
integer

Currency ID associated with the payout.

Exemple:

840

mode
string

Payout mode.

Exemple:

"automatic"

last_error_code
string

Last error code encountered during the payout.

Exemple:

"NO_ERROR"

created_at
string<date-time>

Date and time of payout creation.

Exemple:

"2024-10-23T14:00:00Z"

updated_at
string<date-time>

Date and time of last payout update.

Exemple:

"2024-10-23T14:00:00Z"

approved_at
string<date-time>

Date and time the payout was sent.

Exemple:

"2024-10-23T14:31:00Z"

canceled_at
string<date-time>

Date and time the payout failed.

Exemple:

"2024-10-23T14:32:00Z"

deleted_at
string<date-time>

Date and time of payout deletion.

Exemple:

"2024-10-23T14:33:00Z"

payment_method_id
integer

Payment method ID used for the payout.

Exemple:

1

transaction_key
string

Unique key associated with the payout.

Exemple:

"TRANSACTION-XYZ"

account_id
integer

Account ID associated with the payout.

Exemple:

5