How to create a customer
Create a customer
Creating a customer is pretty simple, since there is only one value which is mandatory.
Create a customer
{ "email": "jane@doe.com", "merchantCustomerId": "xyz" }
Parameter | Mandatory | Description |
---|---|---|
mandatory | E-Mail address of the customer | |
merchantCustomerId | optional | Optional merchant side id for the customer |
Send request with curl
With the body ready we can now send the request via curl.
curl command - line breaks for readability
curl --user MerchantID:APIKey \ -H "Content-Type: application/json" \ -X POST \ -d '{"email":"jane@doe.com","merchantCustomerId":"xyz"}' \
We will now touch on every part of this command.
--user MerchantID:APIKey
Curl Option for HTTP basic access authentication
-H "Content-Type: application/json"
content-type header "application/json" for our API
-X POST
We want the request to be a HTTP POST.
-d '{"email":"jane@doe.com","merchantCustomerId":"xyz"}'
The body for our request in JSON format.
https://apitest.payengine.de/v1/customers
The customers endpoint of our API (Test in this case).
Response
If the Request was successful we should get a response that looks like this:
Response
{ "createdAt": 1501757581860, "modifiedAt": 1501757581860, "email": "jane@doe.com",
Parameter | Description |
---|---|
Parameter | Description |
createdAt | Unix timestamp of the creation of the customer |
modifiedAt | Unix timestamp of last modification of the customer |
The email address set for the customer. Should be the same as in the request. | |
merchantCustomerId | The customer ID you defined. Should be the same as in the request. |
customerId | The Payengine customer id, important for further requests. |
addresses | Addresses associated with the customer. |
personas | Personas associated with the customer. |
paymentInstruments | Payment Instruments associated with the customer. |