Paylink API – Customers

EndpointToiminto
GET api/v1/customersList customers
POST api/v1/customersAdd customer
GET api/v1/customers/{customerId}Get customer
PUT api/v1/customers/{customerId}Edit customer
DELETE api/v1/customers/{customerId}Delete customer

List customers

List all customers in alphabetical order.

Parameters

page Optional
Page from which orders will be fetched. API will return 50 entries in a single page.
GET api/v1/customers
cURL
curl -i -X GET -H "Authorization:Token API-KEY" 'https://test.app.paylink.fi/api/v1/customers?page=1'
Response
{
  "has_more": false,
  "data": [
    {
      "id": 1,
      "email": "matti.meikalainen@example.com",
      "customer_locale": "fi_FI",
      "address": {
        "firstname": "Matti",
        "lastname": "Meikäläinen",
        "company": "",
        "company_id": "",
        "address": "Testikatu 1",
        "city": "Helsinki",
        "postcode": "00100",
        "phone": "+358401234567",
        "country": "FI"
      },
      "created_at": "2020-08-13T14:19:29.000+03:00",
      "updated_at": "2020-08-13T14:40:01.000+03:00"
    },
    ...
  ]
}

Add customer

Add new customer.

Parameters

email Required
Email address
customer_locale Optional
Language, fi_FI or en_US. Default fi_FI
address Required
Billing address. If some field is unknown, dash (-) can be used as placeholder.
Parameters
address.firstname Required
First name
address.lastname Required
Last name
address.company Optional
Company
address.company_id Optional
Business ID
address.city Required
City
address.postcode Required
Postcode
address.phone Optional
Phone number
address.country Required
Country as two-letter country code (e.g. FI)
POST api/v1/customers
cURL
curl -i -X POST \
   -H "Authorization:Token API-KEY" \
   -H "Content-Type:application/json" \
   -d \
'{
  "email": "matti.meikalainen@example.com",
  "customer_locale": "fi_FI",
  "address": {
    "firstname": "Matti",
    "lastname": "Meikäläinen",
    "address": "Testikatu 1",
    "postcode": "00100",
    "city": "Helsinki",
    "phone": "0401234567",
    "country": "FI"
  }
}' \
 'https://test.app.paylink.fi/api/v1/customers'
Response
{
  "id": 1,
  "email": "matti.meikalainen@example.com",
  "customer_locale": "fi_FI",
  "address": {
    "firstname": "Matti",
    "lastname": "Meikäläinen",
    "company": null,
    "company_id": null,
    "address": "Testikatu 1",
    "city": "Helsinki",
    "postcode": "00100",
    "phone": "0401234567",
    "country": "FI"
  },
  "created_at": "2020-08-18T13:12:06.000+03:00",
  "updated_at": "2020-08-18T13:12:06.000+03:00"
}

Get customer

Get customer details.

Parameters

customerId Required
Customer ID
GET api/v1/customers/{customerId}
cURL
curl -i -X GET \
   -H "Authorization:Token API-KEY" \
 'https://test.app.paylink.fi/api/v1/customers/1'
Response
{
  "id": 1,
  "email": "matti.meikalainen@example.com",
  "customer_locale": "fi_FI",
  "address": {
    "firstname": "Matti",
    "lastname": "Meikäläinen",
    "company": null,
    "company_id": null,
    "address": "Testikatu 1",
    "city": "Helsinki",
    "postcode": "00100",
    "phone": "0401234567",
    "country": "FI"
  },
  "created_at": "2020-08-18T13:12:06.000+03:00",
  "updated_at": "2020-08-18T13:12:06.000+03:00"
}

Edit customer

Edit customer details.

Parameters

customerId Required
Customer ID
See other parameters at Add customer »
PUT api/v1/customers/{customerId}
cURL
curl -i -X PUT \
   -H "Authorization:Token API-AVAIN" \
   -H "Content-Type:application/json" \
   -d \
'{
  "email": "matti.meikalainen@example2.com",
  "address": {
    "firstname": "Matti"
  }
}' \
 'https://test.app.paylink.fi/api/v1/customers/1'
Response
{
  "id": 1,
  "email": "matti.meikalainen@example2.com",
  "customer_locale": "fi_FI",
  "address": {
    "firstname": "Matti",
    "lastname": "Meikäläinen",
    "company": null,
    "company_id": null,
    "address": "Testikatu 1",
    "city": "Helsinki",
    "postcode": "00100",
    "phone": "0401234567",
    "country": "FI"
  },
  "created_at": "2020-08-18T13:12:06.000+03:00",
  "updated_at": "2020-08-18T13:19:21.000+03:00"
}

Delete customer

Delete customer.

Parameters

customerId Required
Customer ID
DELETE api/v1/customers/{customerId}
cURL
curl -i -X DELETE \
   -H "Authorization:Token API-AVAIN" \
 'https://test.app.paylink.fi/api/v1/customers/24'