NodeJs
const { FedaPay, Transaction } = require('fedapay');
FedaPay.setApiKey('YOUR_SECRET_API_KEY');
FedaPay.setEnvironment('sandbox');
const transaction = await Transaction.create({
description: 'Payment for order #1234',
amount: 1000,
currency: { iso: 'XOF' },
callback_url: 'https://example.com/callback',
mode: 'mtn_open',
customer: { id: 1 }
});\FedaPay\Fedapay::setApiKey('YOUR_API_KEY');
\FedaPay\Fedapay::setEnvironment('sandbox');
$transaction = \FedaPay\Transaction::create([
'description' => 'Payment for order #1234',
'amount' => 1000,
'currency' => ['iso' => 'XOF'],
'callback_url' => 'https://example.com/callback',
'mode' => 'mtn_open',
'customer' => ['id' => 1]
]);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 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"amount": 123,
"currency": {
"iso": "<string>"
},
"callback_url": "<string>",
"custom_metadata": {},
"customer": {
"id": 123,
"email": "jsmith@example.com",
"firstname": "<string>",
"lastname": "<string>",
"phone_number": {
"number": 123,
"country": "<string>"
}
}
}
'import requests
url = "https://sandbox-api.fedapay.com/v1/transactions"
payload = {
"description": "<string>",
"amount": 123,
"currency": { "iso": "<string>" },
"callback_url": "<string>",
"custom_metadata": {},
"customer": {
"id": 123,
"email": "jsmith@example.com",
"firstname": "<string>",
"lastname": "<string>",
"phone_number": {
"number": 123,
"country": "<string>"
}
}
}
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"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"amount\": 123,\n \"currency\": {\n \"iso\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"custom_metadata\": {},\n \"customer\": {\n \"id\": 123,\n \"email\": \"jsmith@example.com\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n }\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"amount\": 123,\n \"currency\": {\n \"iso\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"custom_metadata\": {},\n \"customer\": {\n \"id\": 123,\n \"email\": \"jsmith@example.com\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n }\n }\n}")
.asString();{
"id": 123,
"reference": "<string>",
"amount": 123,
"description": "<string>",
"callback_url": "<string>",
"status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Collects
Create a transaction
POST
/
transactions
NodeJs
const { FedaPay, Transaction } = require('fedapay');
FedaPay.setApiKey('YOUR_SECRET_API_KEY');
FedaPay.setEnvironment('sandbox');
const transaction = await Transaction.create({
description: 'Payment for order #1234',
amount: 1000,
currency: { iso: 'XOF' },
callback_url: 'https://example.com/callback',
mode: 'mtn_open',
customer: { id: 1 }
});\FedaPay\Fedapay::setApiKey('YOUR_API_KEY');
\FedaPay\Fedapay::setEnvironment('sandbox');
$transaction = \FedaPay\Transaction::create([
'description' => 'Payment for order #1234',
'amount' => 1000,
'currency' => ['iso' => 'XOF'],
'callback_url' => 'https://example.com/callback',
'mode' => 'mtn_open',
'customer' => ['id' => 1]
]);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 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"amount": 123,
"currency": {
"iso": "<string>"
},
"callback_url": "<string>",
"custom_metadata": {},
"customer": {
"id": 123,
"email": "jsmith@example.com",
"firstname": "<string>",
"lastname": "<string>",
"phone_number": {
"number": 123,
"country": "<string>"
}
}
}
'import requests
url = "https://sandbox-api.fedapay.com/v1/transactions"
payload = {
"description": "<string>",
"amount": 123,
"currency": { "iso": "<string>" },
"callback_url": "<string>",
"custom_metadata": {},
"customer": {
"id": 123,
"email": "jsmith@example.com",
"firstname": "<string>",
"lastname": "<string>",
"phone_number": {
"number": 123,
"country": "<string>"
}
}
}
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"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"amount\": 123,\n \"currency\": {\n \"iso\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"custom_metadata\": {},\n \"customer\": {\n \"id\": 123,\n \"email\": \"jsmith@example.com\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n }\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"amount\": 123,\n \"currency\": {\n \"iso\": \"<string>\"\n },\n \"callback_url\": \"<string>\",\n \"custom_metadata\": {},\n \"customer\": {\n \"id\": 123,\n \"email\": \"jsmith@example.com\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n }\n }\n}")
.asString();{
"id": 123,
"reference": "<string>",
"amount": 123,
"description": "<string>",
"callback_url": "<string>",
"status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Autorisations
Corps
application/json
Réponse
Transaction created successfully.

