Customer v2

Customer is a group of your payer.



Endpoint


Method Desciption URI
POST Create Customer /api/v2/customer
GET Get Customers /api/v2/customer
GET Get Customer By Id /api/v2/customer/{ID)
PATCH Update Customer /api/v2/customer/{ID}
DELETE Delete Customer /api/v2/customer/{ID}



Required Headers


Key Value
Accept application/json
Content-Type application/json
Authorization Bearer {ACCESS-TOKEN}


Create Customer

Parameters


Method URI
POST /api/v2/customer

Body


Key Type Required
first_name string Yes
last_name string Yes
address string No
email string Yes
mobile string Yes

Example :


{
    "first_name": "Example-first-name",
    "last_name": "Example-last-name",
    "address": "Kedah",
    "email": "example@email.com",
    "mobile": "010xxxxxxx"
}

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "id": {ID},
        "acc_no": "111111111111",
        "first_name": "Example-first-name",
        "last_name": "Example-last-name",
        "address": "Kedah",
        "email": "example@email.com",
        "mobile": "010xxxxxxx",
        "organization_id": {ID},
        "created_at": "2020-06-25 07:38:11",
        "updated_at": "2020-06-25 07:38:11",
        "deleted_at": null
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 07:38:11 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Get Customers

Parameters


Method URI
GET /api/v2/customer

Include Parameter:


Key Type
organization /api/v2/customer?include=organization
account-groups /api/v2/customer?include=account-groups
account-groups.group /api/v2/collections?include=account-groups.group

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": {ID},
                "acc_no": "111111111111",
                "first_name": "Example-first-name",
                "last_name": "Example-last-name",
                "address": "Kedah",
                "email": "example@email.com",
                "mobile": "010xxxxxxx",
                "organization_id": {ID},
                "created_at": "2020-06-25 07:38:11",
                "updated_at": "2020-06-25 07:38:11",
                "deleted_at": null
             },
            {
                "id": {ID},
                "acc_no": "2222222222222",
                "first_name": "Example-first-name-second",
                "last_name": "Example-last-name-second",
                "address": "Kedah",
                "email": "example2@email.com",
                "mobile": "010xxxxxxx",
                "organization_id": {ID},
                "created_at": "2020-06-26 07:38:11",
                "updated_at": "2020-06-26 07:38:11",
                "deleted_at": null
            },
        ],
        "first_page_url": "{SERVER-URL}/api/v2/customer?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "{SERVER-URL}/api/v2/customer?page=3",
        "next_page_url": "{SERVER-URL}/api/v2/customer?page=2",
        "path": "{SERVER-URL}/api/v2/customer",
        "per_page": 2,
        "prev_page_url": null,
        "to": 2,
        "total": 2
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 08:09:34 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Get Customer by Id

Parameters


Method URI
GET /api/v2/customer/{ID}

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "id": {ID},
        "acc_no": "111111111111",
        "first_name": "Example-first-name",
        "last_name": "Example-last-name",
        "address": "Kedah",
        "email": "example@email.com",
        "mobile": "010xxxxxxx",
        "organization_id": {ID},
        "created_at": "2020-06-25 07:38:11",
        "updated_at": "2020-06-25 07:38:11",
        "deleted_at": null
     },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 08:17:30 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Update Customer

Parameters


Method URI
PATCH /api/v2/customer/{id}

Body:


Key Type Required
first_name string no
last_name string no
address string no
mobile string no

Example :


{
    "first_name": "Example-updated-first-name",
    "last_name": "Example-updated-last-name",
    "address": "Kedah",
    "mobile": "010xxxxxxx"
}

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "id": {ID},
        "acc_no": "11111111111111",
        "first_name": "Example-updated-first-name",
        "last_name": "Example-updated-last-name",
        "address": "Kedah",
        "email": "xample@email.com",
        "mobile": "010xxxxxxx",
        "organization_id": {ID}},
        "created_at": "2020-06-25 07:38:11",
        "updated_at": "2020-06-25 08:29:17",
        "deleted_at": null
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 08:29:17 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors



Delete Customer

Parameters


Method URI
PATCH /api/v2/customer/{id}

Response


{success} Success code : 200

{
    "success": true,
    "data": [],
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 08:32:46 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors