Customers

Customers contain basic information on who the transaction is for and where notifications and confirmations are submitted to. A customer object is required to be associated to a transaction object before a transaction may be processed.

 

The Customer Object

Attributes  
id
string
Universally unique identifier (UUID) per of the customer object.
firstname
string
The firstname of the customer in the provisioned customer object.
lastname
string
The lastname of the customer in the provisioned customer object.
email
string
The email address of the customer in the provisioned customer object.
mobile
string
The mobile or SMS compatible device number of the customer in the provisioned customer object.

 

Get a customer

GET /v2/customer/:id/


Request

curl -s \
       --header "Content-Type: application/json" \
       --header "Authorization: Token :token" \
       --request GET "https://secure-test.addpay.co.za/v2/customers/:id"

 

Response

{
   "meta":{
      "status":"success",
      "message":"OK",
      "code":200
   },
   "data":{
      "id": "c6aa4d14-05c0-432e-98fb-5c4b6f6f624c",
      "firstname": "Bob",
      "lastname": "Bar",
      "email": "bob@example.com",
      "mobile": "27811231234"
   }
}

 

Get a list of customers

GET /v2/customers/


Request

curl -s \
       --header "Content-Type: application/json" \
       --header "Authorization: Token :token" \
       --request GET "https://secure-test.addpay.co.za/v2/customers/"

 

Response

{
   "meta":{
      "status":"success",
      "message":"OK",
      "code":200,
      "pagination":{
         "records":2,
         "page":1,
         "pages":1,
         "limit":"10"
      }
   },
   "data":[
      {
        "id": "c6aa4d14-05c0-432e-98fb-5c4b6f6f624c",
        "firstname": "Bob",
        "lastname": "Bar",
        "email": "bob@example.com",
        "mobile": "27811231234"
      },
      {
        "id": "c6aa4d14-05c0-432e-98fb-5c4b6f6f624c",
        "firstname": "Bob",
        "lastname": "Bar",
        "email": "bob@example.com",
        "mobile": "27811231234"
      }
   ]
}

 

Create a customer

POST /v2/customers/


Request

echo '{ 
     "firstname": "Bob",
     "lastname": "Bar",
     "email": "bob@example.org",
     "mobile": "27811231234"
}' | curl --header "Authorization: Token :token" \
          --header "Content-Type: application/json" \
          --request POST "https://secure-test.addpay.co.za/v2/customers" \
          --data @-

 

Response

{
    "meta": {
        "status": "success",
        "message": "OK",
        "code": 200
    },
    "data": {
      "id": "c6aa4d14-05c0-432e-98fb-5c4b6f6f624c",
      "firstname": "Bob",
      "lastname": "Bar",
      "email": "bob@example.com",
      "mobile": "27811231234"
    }
}

 

Update a customer

PUT /v2/customers/:id


Request

echo '{ 
     "firstname": "Bobby",
}' | curl --header "Authorization: Token :token" \
          --header "Content-Type: application/json" \
          --request PUT "https://secure-test.addpay.co.za/v2/customers/:id" \
          --data @-
 
Response
{
    "meta": {
        "status": "success",
        "message": "OK",
        "code": 200
    },
    "data": {
      "id": "c6aa4d14-05c0-432e-98fb-5c4b6f6f624c",
      "firstname": "Bobby",
      "lastname": "Bar",
      "email": "bob@example.com",
      "mobile": "27811231234"
    }
}

 

Delete a customer

DELETE /v2/customers/:id/


Request
curl -s \
       --header "Content-Type: application/json" \
       --header "Authorization: Token :token" \
       --request DELETE "https://secure-test.addpay.co.za/v2/customers/:id"
 
Response
{
    "meta": {
        "status": "success",
        "message": "OK",
        "code": 200
    }
}

Article Details

Article ID:
107
Rating :

Related articles