Customers
Customers


>>>

GET /api/v1/customers
List customers

List customers

Examples

curl -X GET https://komoju.com/api/v1/customers \
  -u sk_123456:
{
  "resource": "list",
  "total": 3,
  "page": 1,
  "per_page": 10,
  "last_page": 1,
  "data": [
    {
      "id": "8hsy78x87gqd88t9ssndti5ra",
      "resource": "customer",
      "email": "peter@ohara.io",
      "source": null,
      "metadata": {
        "order_id": "abcdefg"
      },
      "created_at": "2018-10-15T03:13:55Z"
    },
    {
      "id": "891zeu2eqxt4wo1mtfq5irhpa",
      "resource": "customer",
      "email": "maritaleannon@lehnernienow.biz",
      "source": null,
      "metadata": {
        "order_id": "abcdefg"
      },
      "created_at": "2018-10-15T03:13:55Z"
    },
    {
      "id": "2x64dv1urh8bvv77ejdp6myq4",
      "resource": "customer",
      "email": "kimberli@maggiostark.co",
      "source": null,
      "metadata": {
        "order_id": "abcdefg"
      },
      "created_at": "2018-10-15T03:13:55Z"
    }
  ]
}

>>>

GET /api/v1/customers/:id
Show a customer

Show a customer

Examples

curl -X GET https://komoju.com/api/v1/customers/0mj6hn7godwn6if0q429305is \
  -u sk_123456:
{
  "id": "0mj6hn7godwn6if0q429305is",
  "resource": "customer",
  "email": "virginia@baileygaylord.biz",
  "source": null,
  "metadata": {
    "order_id": "abcdefg"
  },
  "created_at": "2018-10-15T03:13:55Z"
}

>>>

POST /api/v1/customers
Create a customer

Create a customer

Examples

curl -X POST https://komoju.com/api/v1/customers \
  -u sk_123456: \
  -d "email=test@example.com" \
  -d "metadata[order_id]=abcdefg" \
  -d "payment_details=tok_d78b927f890d0870181f81e633e033202f10ea5034f373df0c4548c0d7bf0ba3emswjxvzqtb1jxgbxf94c6smp" 
{
  "id": "2kubz3cb6e4cmp12jjtlabw3e",
  "resource": "customer",
  "email": "test@example.com",
  "source": {
    "type": "credit_card",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2023
  },
  "metadata": {
    "order_id": "abcdefg"
  },
  "created_at": "2018-10-15T03:13:55Z"
}

Params

Param name Description
payment_details
required
A hash or token describing the payment method used to make the payment.
currency
optional
3 letter ISO currency code of the transaction
email
optional
Customer's email address.
metadata
optional
A set of key-value pairs

>>>

PATCH /api/v1/customers/:id
Update customers

Update customers

Examples

curl -X PATCH https://komoju.com/api/v1/customers/9o8p8mu5rz6y026vxiolr6xg2 \
  -u sk_123456: \
  -d "payment_details=tok_8dc74fca51d8ac364a56974957f97d5bcc22a8f5caf2a1068a680b98b39101d33bafyzlg6ktbqb86ph1gd6nx2" 
{
  "id": "9o8p8mu5rz6y026vxiolr6xg2",
  "resource": "customer",
  "email": "tommysauer@pollich.net",
  "source": {
    "type": "credit_card",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2023
  },
  "metadata": {
    "order_id": "abcdefg"
  },
  "created_at": "2018-10-15T03:13:55Z"
}

Params

Param name Description
currency
optional
3 letter ISO currency code of the transaction
payment_details
optional
A hash or token describing the payment method used to make the payment.
email
optional
Customer's email address.
metadata
optional
A set of key-value pairs

>>>

DELETE /api/v1/customers/:id
Destroy a customer

Destroy a customer

Examples

curl -X DELETE https://komoju.com/api/v1/customers/c9f7we2075tx3bb48zbk0txa6 \
  -u sk_123456:
{
  "id": "c9f7we2075tx3bb48zbk0txa6",
  "resource": "customer",
  "email": "christiantromp@nikolaus.com",
  "source": null,
  "metadata": {
    "order_id": "abcdefg"
  },
  "created_at": "2018-10-15T03:13:55Z"
}