NodeJs
const { FedaPay, Customer } = require('fedapay');
/* Replace YOUR_SECRETE_API_KEY with your real API key */
FedaPay.setApiKey("YOUR_SECRETE_API_KEY");
/* Specify whether you want to run your query in test or live mode */
FedaPay.setEnvironment('sandbox'); //or setEnvironment('live');
/* Create customer */
const customer = await Customer.create({
firstname: 'John',
lastname: 'Doe',
email: 'john@doe.com',
phone_number: {
number: '90090909',
country: 'BJ'
}
});/* Replace YOUR_SECRETE_API_KEY with your secret API key */
\FedaPay\FedaPay::setApiKey("YOUR_SECRETE_API_KEY");
/* Specify whether you want to run your query in test or live mode */
\FedaPay\FedaPay::setEnvironment('sandbox'); //or setEnvironment('live');
/* Create customer */
\FedaPay\Customer::create(array(
"firstname" => "John",
"lastname" => "Doe",
"email" => "John.doe@gmail.com",
"phone_number" => [
"number" => "+22966666600",
"country" => 'bj' // 'bj' Benin code
]
));require 'fedapay';
# configure FedaPay library
FedaPay.api_key = '' # Your secret api key
FedaPay.environment = '' # sandbox or live
phone = {
country: 'bj',
number: '66000001'
};
customer = FedaPay::Customer.create(
firstname: 'firstname',
lastname: 'lastname',
email: 'email@test.com',
phone_number: phone
);curl --request POST \
--url https://sandbox-api.fedapay.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"phone_number": {
"number": 123,
"country": "<string>"
},
"firstname": "<string>",
"lastname": "<string>"
}
'import requests
url = "https://sandbox-api.fedapay.com/v1/customers"
payload = {
"email": "jsmith@example.com",
"phone_number": {
"number": 123,
"country": "<string>"
},
"firstname": "<string>",
"lastname": "<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/customers"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n },\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\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/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n },\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n}")
.asString();{
"id": 123,
"firstname": "<string>",
"lastname": "<string>",
"full_name": "<string>",
"email": "jsmith@example.com",
"account_id": 123,
"phone_number_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}Create a customer
POST
/
customers
NodeJs
const { FedaPay, Customer } = require('fedapay');
/* Replace YOUR_SECRETE_API_KEY with your real API key */
FedaPay.setApiKey("YOUR_SECRETE_API_KEY");
/* Specify whether you want to run your query in test or live mode */
FedaPay.setEnvironment('sandbox'); //or setEnvironment('live');
/* Create customer */
const customer = await Customer.create({
firstname: 'John',
lastname: 'Doe',
email: 'john@doe.com',
phone_number: {
number: '90090909',
country: 'BJ'
}
});/* Replace YOUR_SECRETE_API_KEY with your secret API key */
\FedaPay\FedaPay::setApiKey("YOUR_SECRETE_API_KEY");
/* Specify whether you want to run your query in test or live mode */
\FedaPay\FedaPay::setEnvironment('sandbox'); //or setEnvironment('live');
/* Create customer */
\FedaPay\Customer::create(array(
"firstname" => "John",
"lastname" => "Doe",
"email" => "John.doe@gmail.com",
"phone_number" => [
"number" => "+22966666600",
"country" => 'bj' // 'bj' Benin code
]
));require 'fedapay';
# configure FedaPay library
FedaPay.api_key = '' # Your secret api key
FedaPay.environment = '' # sandbox or live
phone = {
country: 'bj',
number: '66000001'
};
customer = FedaPay::Customer.create(
firstname: 'firstname',
lastname: 'lastname',
email: 'email@test.com',
phone_number: phone
);curl --request POST \
--url https://sandbox-api.fedapay.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"phone_number": {
"number": 123,
"country": "<string>"
},
"firstname": "<string>",
"lastname": "<string>"
}
'import requests
url = "https://sandbox-api.fedapay.com/v1/customers"
payload = {
"email": "jsmith@example.com",
"phone_number": {
"number": 123,
"country": "<string>"
},
"firstname": "<string>",
"lastname": "<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/customers"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n },\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\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/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"phone_number\": {\n \"number\": 123,\n \"country\": \"<string>\"\n },\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n}")
.asString();{
"id": 123,
"firstname": "<string>",
"lastname": "<string>",
"full_name": "<string>",
"email": "jsmith@example.com",
"account_id": 123,
"phone_number_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corps
application/json
Réponse
Customer created successfully.
Customer ID.
Customer's first name.
Customer's last name.
Customer's full name.
Customer's email address.
ID of the customer's account.
ID of the customer's phone number.
Date and time of customer creation.
Date and time of last customer update.
Date and time of customer deletion (if applicable).

