Skip to content

      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"
      }
      ParameterMandatoryDescription
      emailmandatoryE-Mail address of the customer
      merchantCustomerIdoptionalOptional 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"}' \  
      https://apitest.payengine.de/v1/customers

      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",
      	  "merchantCustomerId": "xyz",
      	  "customerId": "Customer-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
      	  "addresses": [],
      	  "personas": [],
      	  "paymentInstruments": []
      	}
      ParameterDescription
      ParameterDescription
      createdAtUnix timestamp of the creation of the customer
      modifiedAtUnix timestamp of last modification of the customer
      emailThe email address set for the customer. Should be the same as in the request.
      merchantCustomerIdThe customer ID you defined. Should be the same as in the request.
      customerIdThe Payengine customer id, important for further requests.
      addressesAddresses associated with the customer.
      personasPersonas associated with the customer.
      paymentInstrumentsPayment Instruments associated with the customer.