Customers
Each FedaPay transaction is linked to one of your account customer. So to start receiving payment from one of your customers, you must beforehand register him. To do so, send a request to add via the API with as parameters all information about your customer. Use this code to send your customer creation request.
Replace YOUR_API_SECRET_KEY by the API secret key of your sandbox or live account.
If you are using your live account, you must replace
the link by https://api.fedapay.com/v1/customers
curl -X POST \
https://sandbox-api.fedapay.com/v1/customers \
-H 'Authorization: Bearer VOTRE_CLE_API_PRIVEE' \
-H 'Content-Type: application/json' \
-d '{
"firstname" : "John",
"lastname" : "Doe",
"email" : "[email protected]",
"phone_number" : {
"number" : "+22966666600",
"country" : "bj"
}
}'
/* Replace YOUR_API_SECRET_KEY by your API secret key */
\FedaPay\FedaPay::setApiKey("YOUR_API_SECRET_KEY");
/* Specify whenever you are willing to execute your request in test or live mode */
\FedaPay\FedaPay::setEnvironment('sandbox'); //or setEnvironment('live');
/* Create the customer */
\FedaPay\Customer::create(array(
"firstname" => "John",
"lastname" => "Doe",
"email" => "[email protected]",
"phone_number" => [
"number" => "+22966666600",
"country" => 'bj' // 'bj' Benin country code
]
));
const { FedaPay, Customer } = require('fedapay')
/* Replace YOUR_API_SECRET_KEY by your secret API key */
FedaPay.setApiKey("YOUR_API_SECRET_KEY");
/* Specify whenever you are willing to execute your request in test or live mode */
FedaPay.setEnvironment('sandbox'); //or setEnvironment('live');
/* Create the customer */
const customer = await Customer.create({
firstname: 'John',
lastname: 'Doe',
email: '[email protected]',
phone_number: {
number: '90090909',
country: 'BJ'
}
});
Your request for adding a new customer must contain the informations about him.
These information are required because they are used during transactions.
So be sure to only provide true and accurate information about your customer.
All you will have to do is to provide the values of the parameters intended for this purpose by the system to create a customer.
firstname
: the customer’s first name(s)lastname
: his last name-
email
: his e-mail address -
phone_number
: his phone number (optional)