Tổng đài hỗ trợ - 
1900 6750
( 7:00 - 22:00 )

Customer

Một tài nguyên Customer đại diện cho một tài khoản khách hàng của Shop. Tài khoản Customer lưu trữ thông tin liên hệ của khách hàng giúp cho người dùng đã đăng nhập không phải khai báo thông tin mỗi khi thực hiện đặt hàng. Vì lí do bảo mật, tài nguyên Customer không lưu thông tin thẻ của khách hàng. Khách hàng sẽ vẫn phải cung cấp thông tin thẻ mỗi khi thực hiện thanh toán.

Tài nguyên Customer cũng lưu trữ một vào thông tin thêm của khách hàng cho chủ Shop, bao gồm: số đơn hàng, tổng số tiền khách hàng đã tiêu....

Việc sử dụng tài nguyên Customer của Shop sẽ phụ thuộc vào các cấu hình tài khoản thanh toán. Đối với chủ Shop, cấu hình này được đặt trong trang quản trị, tab "Cấu hình", trang "Cấu hình thanh toán". Có 3 tùy chọn cho cấu hình này:

  • Guest checkout only: Vô hiệu hóa chức năng tài khoản. Có nghĩa là khách hàng không thể đăng nhập và chỉ có thể thanh toán như khách hàng vãng lai.
  • Guest checkout with optional sign-in: Không bắt buộc có tài khoản. Khách hàng có thể lựa chọn đăng nhập tài khoản hoặc tiến hành thanh toán như khách vãng lai. Với thiết lập này, khách hàng có thể tự tạo tài khoản để sử dụng.
  • Sign-in required: Bắt buộc có tài khoản. Khách hàng sẽ không thể thực hiện thanh toán nếu như không đăng nhập.

Bạn có thể làm gì với Customer?

Sapo API cho phép bạn thực hiện các thao tác sau với tài nguyên Customer. Các phiên bản chi tiết hơn của những thao tác này có thể có:

Các thuộc tính của Customer

accepts_marketing
{ "accepts_marketing" : false }

Xác định xem khách hàng có đồng ý nhận các thông tin marketing qua email không. Các giá trị hợp lệ là "true" và "false."

addresses
{ "address1" : "Chestnut Street 92" }
{ "address2" : "Apartment 2" }
{ "city" : "Louisville" }
{ "company" : "null" }
{ "country" : "united states" }
{ "first_name" : "Bob" }
{ "id" : 207119551 }
{ "last_name" : "Norman" }
{ "phone" : "+84345678900" }
{ "province" : "Kentucky" }
{ "zip" : "40202" }
{ "province_code" : "KY" }
{ "country_code" : "US" }
{ "country_name" : "United States" }
{ "primary" : "null" }

Danh sách các địa chỉ của khách hàng. Mỗi địa chỉ có thể có các thông tin sau:

  • address1: Địa chỉ của khách hàng.
  • address2: Địa chỉ khác của khách hàng.
  • city: Tỉnh/Thành phố.
  • company: Công ty.
  • country: Quốc gia.
  • country_code: Mã quốc gia.
  • country_name: Tên quốc gia.
  • primary: Xác định địa chỉ này có phải địa chỉ chính của khách hàng không. Các giá trị hợp lệ là "true" và "false."
  • first_name: Tên.
  • id: Số duy nhất định danh địa chỉ.
  • last_name: Họ.
  • name: Họ và tên.
  • phone: Số điện thoại.
  • province: Tỉnh/thành phố.
  • province_code: Mã tỉnh/thành phố.
  • zip: Mã zip hoặc mã bưu điện.
created_on
{ "created_on" : "2013-06-27T08:48:27Z" }

Thời gian Customer được tạo. API trả về kết quả theo định dạng chuẩn ISO 8601.

default_address
{ "address1" : "Chestnut Street 92" }
{ "address2" : "Apartment 2" }
{ "city" : "Louisville" }
{ "company" : "null" }
{ "country" : "united states" }
{ "first_name" : "Bob" }
{ "id" : 207119551 }
{ "last_name" : "Norman" }
{ "phone" : "+84345678900" }
{ "province" : "Kentucky" }
{ "zip" : "40202" }
{ "province_code" : "KY" }
{ "country_code" : "US" }
{ "country_name" : "United States" }
{ "primary" : "null" }

Địa chỉ mặc định của Customer. Địa chỉ mặc định có thể bao gồm các thông tin sau:

  • address1: Địa chỉ.
  • address2: Địa chỉ khác.
  • city: Tỉnh/Thành phố.
  • company: Công ty
  • country: Quốc gia.
  • country_code: Mã quốc gia.
  • country_name: Tên quốc gia.
  •  
  • primary: Xác định địa chỉ này có phải địa chỉ mặc định không. Các giá trị hợp lệ là "true" và "false."
  • first_name: Tên.
  • id: Số duy nhất định danh địa chỉ.
  • last_name: Họ.
  • name: Họ và tên.
  • phone: Số điện thoại.
  • province: Tỉnh/Thành phố.
  • province_code: Mã tỉnh/thành phố.
  • zip: Mã zip hoặc mã bưu điện.
email
{ "email" : "[email protected]" }

Địa chỉ email của khách hàng.

first_name
{ "first_name" : "John" }

Tên khách hàng.

phone
{ phone : "+84345678900" }

Số điện thoại khách hàng

id
{ "id" : 207119551 }

Số duy nhất định danh khách hàng.

metafield
{ "key" : "new" }
{ "value" : "newvalue" }
{ "value_type" : "string" }
{ "key" : "global" }

Đính kèm các thông tin dưới dạng metadata vào tài nguyên của Shop:

  • key (required):Định danh cho metafield (tối đa 30 ký tự).
  • namespace (required): Chứa tập hợp các dữ liệu metadata. Namespaces được dùng để phân biệt giữa các metadata của cùng loại dữ liệu mà do người dùng khác nhau đưa lên (tối đa 20 ký tự).
  • value (required): Thông tin được lưu trữ dưới dạng metadata.
  • value_type (required): Xác định thông tin được lưu trữ theo kiểu 'xâu' hay kiểu 'số nguyên'
  • description (optional): Thông tin thêm về metafield.
last_name
{ "last_name" : "Norman" }

Họ của khách hàng.

last_order_id
{ "last_order_id" : "null" }

Id của đơn hàng cuối cùng của khách hàng.

last_order_name
{ "last_order_name" : "null" }

Đơn hàng cuối cùng của khách hàng.

note
{ "note" : "null" }

Ghi chú về khách hàng.

orders_count
{ "orders_count" : 0 }

Số lượng đơn hàng của khách hàng.

state
{ "state" : "null" }

Trạng thái của Customer trong shop. Customer bắt đầu bằng trạng thái "disabled". Khách hàng sau đó có thể:

  • decline: từ chối khởi tạo tài khoản.
  • invited: đồng ý khởi tạo tài khoản. Trạng thái lúc đó sẽ chuyển từ "disabled" sang "enabled."

Chủ shop cũng có thể đóng một tài khoản khách hàng.

tags
{ "tags" : "tagsational" }

Tag là những mô tả thêm, ngắn trình bày dưới định dạng một xâu ký tự cách nhau bởi dấu phẩy. Ví dụ, một Customer có 3 tags: tag1, tag2, tag3.

total_spent
{ "total_spent" : "0.00" }

Tổng số tiền mà khách hàng đã chi tiêu trên shop.

modified_on
{ "modified_on" : "2012-08-24T14:01:46Z" }

Thời gian thông tin khách hàng bị chỉnh sửa. API trả về kết quả theo định dạng chuẩn ISO 8601.

verified_email
{ "verified_email" : true }

Xác định xem địa chỉ email đã được xác nhận hay chưa.

gender
{ "gender" : "other" }

Giới tính của khách hàng.Bao gồm các giá trị sau:

  • Male: Nam.
  • Female: Nữ
  • Other: Khác.
dob
{ "dob" : "2022-01-10" }

Ngày sinh của khách hàng. Định dạng "yyyy-mm-dd"

Endpoints

GET/admin/customers.json

Lấy toàn bộ danh sách Customer của shop

since_id

Giới hạn kết quả sau một ID xác định

created_on_min

Hiển thị các Customer được tạo sau ngày này (định dạng: 2008-12-31 03:00)

created_on_max

Hiển thị các Customer được tạo trước ngày này (định dạng: 2008-12-31 03:00)

modified_on_min

Hiển thị các Customer được cập nhật sau ngày này (định dạng: 2008-12-31 03:00)

modified_on_max

Hiển thị các Customer được cập nhật trước ngày này (định dạng: 2008-12-31 03:00)

limit

Số lượng kết quả trả về

(mặc định: 50) (tối đa: 250)
page

Số trang

(mặc định: 1)
fields

Danh sách các trường trong kết quả trả về, cách nhau bởi dấu phẩy

Lấy tất cả các Customer của shop được thay đổi sau một ngày xác định

GET /admin/customers.json?modified_on_min=2015-09-01 18:52:18
Xem kết quả
HTTP/1.1 200 OK
{
  "customers": [
    {
      "id": 207119551,
      "email": "[email protected]",
      "accepts_marketing": false,
      "created_on": "2015-09-02T14:52:15Z",
      "modified_on": "2015-09-02T14:52:15Z",
      "first_name": "Bob",
      "last_name": "Norman",
      "orders_count": 1,
      "state": "disabled",
      "total_spent": "41.94",
      "last_order_id": 450789469,
      "note": null,
      "verified_email": true,
      
      "tags": "",
      "last_order_name": "#1001",
      "default_address": {
        "id": 207119551,
        "first_name": null,
        "last_name": null,
        "company": null,
        "address1": "Chestnut Street 92",
        "address2": "",
        "city": "Louisville",
        "province": "Kentucky",
        "country": "United States",
        "zip": "40202",
        "phone": "555-625-1199",
        "name": "",
        "province_code": "KY",
        "country_code": "US",
        "country_name": "United States",
        "primary": true
      },
      "addresses": [
        {
          "id": 207119551,
          "first_name": null,
          "last_name": null,
          "company": null,
          "address1": "Chestnut Street 92",
          "address2": "",
          "city": "Louisville",
          "province": "Kentucky",
          "country": "United States",
          "zip": "40202",
          "phone": "555-625-1199",
          "name": "",
          "province_code": "KY",
          "country_code": "US",
          "country_name": "United States",
          "primary": true
        }
      ]
    }
  ]
}

Lấy toàn bộ Customer của Shop

GET /admin/customers.json
Xem kết quả
HTTP/1.1 200 OK
{
  "customers": [
    {
      "id": 207119551,
      "email": "[email protected]",
      "accepts_marketing": false,
      "created_on": "2015-09-02T14:52:18Z",
      "modified_on": "2015-09-02T14:52:18Z",
      "first_name": "Bob",
      "last_name": "Norman",
      "orders_count": 1,
      "state": "disabled",
      "total_spent": "41.94",
      "last_order_id": 450789469,
      "note": null,
      "verified_email": true,
      
      "tags": "",
      "last_order_name": "#1001",
      "default_address": {
        "id": 207119551,
        "first_name": null,
        "last_name": null,
        "company": null,
        "address1": "Chestnut Street 92",
        "address2": "",
        "city": "Louisville",
        "province": "Kentucky",
        "country": "United States",
        "zip": "40202",
        "phone": "555-625-1199",
        "name": "",
        "province_code": "KY",
        "country_code": "US",
        "country_name": "United States",
        "primary": true
      },
      "addresses": [
        {
          "id": 207119551,
          "first_name": null,
          "last_name": null,
          "company": null,
          "address1": "Chestnut Street 92",
          "address2": "",
          "city": "Louisville",
          "province": "Kentucky",
          "country": "United States",
          "zip": "40202",
          "phone": "555-625-1199",
          "name": "",
          "province_code": "KY",
          "country_code": "US",
          "country_name": "United States",
          "primary": true
        }
      ]
    }
  ]
}

Lấy tất cả các Customer sau một ID xác định

GET /admin/customers.json?since_id=207119551
Xem kết quả
HTTP/1.1 200 OK
{
  "customers": [
    {
      "id": 1018520259,
      "email": "[email protected]",
      "accepts_marketing": false,
      "created_on": "2015-09-02T14:52:31Z",
      "modified_on": "2015-09-02T14:52:31Z",
      "first_name": "Steve",
      "last_name": "Lastnameson",
      "orders_count": 0,
      "state": "disabled",
      "total_spent": "0.00",
      "last_order_id": null,
      "note": null,
      "verified_email": true,
      
      "tags": "",
      "last_order_name": null,
      "default_address": {
        "id": 1053317306,
        "first_name": "Mother",
        "last_name": "Lastnameson",
        "company": null,
        "address1": "123 Oak St",
        "address2": null,
        "city": "Ottawa",
        "province": "Ontario",
        "country": "Canada",
        "zip": "123 ABC",
        "phone": "555-1212",
        "name": "Mother Lastnameson",
        "province_code": "ON",
        "country_code": "CA",
        "country_name": "Canada",
        "primary": true
      },
      "addresses": [
        {
          "id": 1053317306,
          "first_name": "Mother",
          "last_name": "Lastnameson",
          "company": null,
          "address1": "123 Oak St",
          "address2": null,
          "city": "Ottawa",
          "province": "Ontario",
          "country": "Canada",
          "zip": "123 ABC",
          "phone": "555-1212",
          "name": "Mother Lastnameson",
          "province_code": "ON",
          "country_code": "CA",
          "country_name": "Canada",
          "primary": true
        }
      ]
    }
  ]
}
GET/admin/customers/207119551.json
fields

danh sách các trường trong kết quả trả về, cách nhau bởi dấu phẩy

Lấy một Customer bằng ID

GET /admin/customers/#{id}.json
Xem kết quả
HTTP/1.1 200 OK
{
  "customer": {
    "id": 207119551,
    "email": "[email protected]",
    "accepts_marketing": false,
    "created_on": "2015-09-02T14:52:25Z",
    "modified_on": "2015-09-02T14:52:25Z",
    "first_name": "Bob",
    "last_name": "Norman",
    "orders_count": 1,
    "state": "disabled",
    "total_spent": "41.94",
    "last_order_id": 450789469,
    "note": null,
    "verified_email": true,
    
    "tags": "",
    "last_order_name": "#1001",
    "default_address": {
      "id": 207119551,
      "first_name": null,
      "last_name": null,
      "company": null,
      "address1": "Chestnut Street 92",
      "address2": "",
      "city": "Louisville",
      "province": "Kentucky",
      "country": "United States",
      "zip": "40202",
      "phone": "555-625-1199",
      "name": "",
      "province_code": "KY",
      "country_code": "US",
      "country_name": "United States",
      "primary": true
    },
    "addresses": [
      {
        "id": 207119551,
        "first_name": null,
        "last_name": null,
        "company": null,
        "address1": "Chestnut Street 92",
        "address2": "",
        "city": "Louisville",
        "province": "Kentucky",
        "country": "United States",
        "zip": "40202",
        "phone": "555-625-1199",
        "name": "",
        "province_code": "KY",
        "country_code": "US",
        "country_name": "United States",
        "primary": true
      }
    ]
  }
}
POST/admin/customers.json

Tạo một Customer mới

POST /admin/customers.json
{
  "customer": {
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "email": "[email protected]",
    "verified_email": true,
    "addresses": [
      {
        "address1": "123 Oak St",
        "city": "Ottawa",
        "province": "ON",
        "phone": "555-1212",
        "zip": "123 ABC",
        "last_name": "Lastnameson",
        "first_name": "Mother",
        "country": "CA"
      }
    ]
  }
}
Xem kết quả
HTTP/1.1 201 Created
{
  "customer": {
    "id": 1018520255,
    "email": "[email protected]",
    "accepts_marketing": false,
    "created_on": "2015-09-02T14:52:08Z",
    "modified_on": "2015-09-02T14:52:08Z",
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "orders_count": 0,
    "state": "disabled",
    "total_spent": "0.00",
    "last_order_id": null,
    "note": null,
    "verified_email": true,
    
    "tags": "",
    "last_order_name": null,
    "default_address": {
      "id": 1053317302,
      "first_name": "Mother",
      "last_name": "Lastnameson",
      "company": null,
      "address1": "123 Oak St",
      "address2": null,
      "city": "Ottawa",
      "province": "Ontario",
      "country": "Canada",
      "zip": "123 ABC",
      "phone": "555-1212",
      "name": "Mother Lastnameson",
      "province_code": "ON",
      "country_code": "CA",
      "country_name": "Canada",
      "primary": true
    },
    "addresses": [
      {
        "id": 1053317302,
        "first_name": "Mother",
        "last_name": "Lastnameson",
        "company": null,
        "address1": "123 Oak St",
        "address2": null,
        "city": "Ottawa",
        "province": "Ontario",
        "country": "Canada",
        "zip": "123 ABC",
        "phone": "555-1212",
        "name": "Mother Lastnameson",
        "province_code": "ON",
        "country_code": "CA",
        "country_name": "Canada",
        "primary": true
      }
    ]
  }
}

Tạo một Customer với metafield

POST /admin/customers.json
{
  "customer": {
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "email": "[email protected]",
    "verified_email": true,
    "addresses": [
      {
        "address1": "123 Oak St",
        "city": "Ottawa",
        "province": "ON",
        "phone": "555-1212",
        "zip": "123 ABC",
        "last_name": "Lastnameson",
        "first_name": "Mother",
        "country": "CA"
      }
    ],
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
Xem kết quả
HTTP/1.1 201 Created
{
  "customer": {
    "id": 1018520260,
    "email": "[email protected]",
    "accepts_marketing": false,
    "created_on": "2015-09-02T14:52:44Z",
    "modified_on": "2015-09-02T14:52:44Z",
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "orders_count": 0,
    "state": "disabled",
    "total_spent": "0.00",
    "last_order_id": null,
    "note": null,
    "verified_email": true,
    
    "tags": "",
    "last_order_name": null,
    "default_address": {
      "id": 1053317307,
      "first_name": "Mother",
      "last_name": "Lastnameson",
      "company": null,
      "address1": "123 Oak St",
      "address2": null,
      "city": "Ottawa",
      "province": "Ontario",
      "country": "Canada",
      "zip": "123 ABC",
      "phone": "555-1212",
      "name": "Mother Lastnameson",
      "province_code": "ON",
      "country_code": "CA",
      "country_name": "Canada",
      "primary": true
    },
    "addresses": [
      {
        "id": 1053317307,
        "first_name": "Mother",
        "last_name": "Lastnameson",
        "company": null,
        "address1": "123 Oak St",
        "address2": null,
        "city": "Ottawa",
        "province": "Ontario",
        "country": "Canada",
        "zip": "123 ABC",
        "phone": "555-1212",
        "name": "Mother Lastnameson",
        "province_code": "ON",
        "country_code": "CA",
        "country_name": "Canada",
        "primary": true
      }
    ]
  }
}

Tạo một Customer không có email hoặc tên sẽ trả về thông báo lỗi

POST /admin/customers.json
{
  "customer": {
    "email": null,
    "first_name": null,
    "last_name": null
  }
}
Xem kết quả
HTTP/1.1 422 Unprocessable Entity
{
  "customer": {
    "id": null,
    "email": null,
    "accepts_marketing": false,
    "created_on": null,
    "modified_on": null,
    "first_name": null,
    "last_name": null,
    "orders_count": 0,
    "state": "disabled",
    "total_spent": "0.00",
    "last_order_id": null,
    "note": null,
    "verified_email": true,
    
    "tags": "",
    "last_order_name": null,
    "addresses": [
    ]
  },
  "errors": {
    "base": [
      "Customer must have a name or email address"
    ]
  }
}
PUT/admin/customers/207119551.json

Thêm metafield cho Customer

PUT /admin/customers/#{id}.json
{
  "customer": {
    "id": 207119551,
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
Xem kết quả
HTTP/1.1 200 OK
{
  "customer": {
    "id": 207119551,
    "email": "[email protected]",
    "accepts_marketing": false,
    "created_on": "2015-09-02T14:52:47Z",
    "modified_on": "2015-09-02T14:52:50Z",
    "first_name": "Bob",
    "last_name": "Norman",
    "orders_count": 1,
    "state": "disabled",
    "total_spent": "41.94",
    "last_order_id": 450789469,
    "note": null,
    "verified_email": true,
    
    "tags": "",
    "last_order_name": "#1001",
    "default_address": {
      "id": 207119551,
      "first_name": null,
      "last_name": null,
      "company": null,
      "address1": "Chestnut Street 92",
      "address2": "",
      "city": "Louisville",
      "province": "Kentucky",
      "country": "United States",
      "zip": "40202",
      "phone": "555-625-1199",
      "name": "",
      "province_code": "KY",
      "country_code": "US",
      "country_name": "United States",
      "primary": true
    },
    "addresses": [
      {
        "id": 207119551,
        "first_name": null,
        "last_name": null,
        "company": null,
        "address1": "Chestnut Street 92",
        "address2": "",
        "city": "Louisville",
        "province": "Kentucky",
        "country": "United States",
        "zip": "40202",
        "phone": "555-625-1199",
        "name": "",
        "province_code": "KY",
        "country_code": "US",
        "country_name": "United States",
        "primary": true
      }
    ]
  }
}

Cập nhật chi tiết cho Customer

PUT /admin/customers/#{id}.json
{
  "customer": {
    "id": 207119551,
    "email": "[email protected]",
    "note": "Customer is a great guy"
  }
}
Xem kết quả
HTTP/1.1 200 OK
{
  "customer": {
    "id": 207119551,
    "email": "[email protected]",
    "accepts_marketing": false,
    "created_on": "2015-09-02T14:52:50Z",
    "modified_on": "2015-09-02T14:52:53Z",
    "first_name": "Bob",
    "last_name": "Norman",
    "orders_count": 1,
    "state": "disabled",
    "total_spent": "41.94",
    "last_order_id": 450789469,
    "note": "Customer is a great guy",
    "verified_email": true,
    
    "tags": "",
    "last_order_name": "#1001",
    "default_address": {
      "id": 207119551,
      "first_name": null,
      "last_name": null,
      "company": null,
      "address1": "Chestnut Street 92",
      "address2": "",
      "city": "Louisville",
      "province": "Kentucky",
      "country": "United States",
      "zip": "40202",
      "phone": "555-625-1199",
      "name": "",
      "province_code": "KY",
      "country_code": "US",
      "country_name": "United States",
      "primary": true
    },
    "addresses": [
      {
        "id": 207119551,
        "first_name": null,
        "last_name": null,
        "company": null,
        "address1": "Chestnut Street 92",
        "address2": "",
        "city": "Louisville",
        "province": "Kentucky",
        "country": "United States",
        "zip": "40202",
        "phone": "555-625-1199",
        "name": "",
        "province_code": "KY",
        "country_code": "US",
        "country_name": "United States",
        "primary": true
      }
    ]
  }
}
DELETE/admin/customers/207119551.json

Xóa một Customer. Một Customer không thể bị xóa nếu đã có đơn hàng

Xóa một Customer

DELETE /admin/customers/#{id}.json
Xem kết quả
HTTP/1.1 200 OK
{}
GET/admin/customers/count.json

Lấy tổng số các Customer

Lấy tổng số Customer của Shop

GET /admin/customers/count.json
Xem kết quả
HTTP/1.1 200 OK
{
  "count": 1
}
GET/admin/orders.json

Lấy tất cả các đơn hàng của Customer

Lấy tất cả đơn hàng của Customer trong Shop

GET /admin/orders.json?customer_id=207119551
Xem kết quả
HTTP/1.1 200 OK
{
  "orders": [
    {
      "id": 450789469,
      "email": "[email protected]",
      "closed_at": null,
      "created_on": "2008-01-10T11:00:00Z",
      "modified_on": "2008-01-10T11:00:00Z",
      "number": 1,
      "note": null,
      "token": "b1946ac92492d2347c6235b4d2611184",
      "gateway": "authorize_net",
      "test": false,
      "total_weight": 0,
      "taxes_included": false,
      "currency": "USD",
      "financial_status": "authorized",
      "confirmed": false,
      "cart_token": "68778783ad298f1c80c3bafcddeea02f",
      "buyer_accepts_marketing": false,
      "name": "#1001",
      "total_line_items_price": "398.00",
      "total_price": "409.94",
      "subtotal_price": "398.00",
      "total_tax": "11.94",
      "total_discounts": "0.00",
      "referring_site": "http:\/\/www.otherexample.com",
      "landing_site": "http:\/\/www.example.com?source=abc",
      "cancelled_at": null,
      "cancel_reason": null,
      "total_price_usd": "409.94",
      "checkout_token": null,
      "reference": "fhwdgads",
      "user_id": null,
      "location_id": null,
      "source_identifier": "fhwdgads",
      "source_url": null,
      "processed_at": "2008-01-10T11:00:00Z",
      "device_id": null,
      "browser_ip": null,
      "landing_site_ref": "abc",
      "order_number": 1001,
      "discount_codes": [
        {
          "code": "TENOFF",
          "amount": "10.00",
          "type": "percentage"
        }
      ],
      "note_attributes": [
        {
          "name": "custom engraving",
          "value": "Happy Birthday"
        },
        {
          "name": "colour",
          "value": "green"
        }
      ],
      "payment_gateway_names": [
        "bogus"
      ],
      "processing_method": "direct",
      "source": "browser",
      "checkout_id": 450789469,
      "source_name": "web",
      "fulfillment_status": null,
      "tax_lines": [
        {
          "title": "State Tax",
          "price": "11.94",
          "rate": 0.06
        }
      ],
      "tags": "",
      "line_items": [
        {
          "id": 466157049,
          "variant_id": 39072856,
          "title": "IPod Nano - 8gb",
          "quantity": 1,
          "grams": 200,
          "sku": "IPOD2008GREEN",
          "variant_title": "green",
          "vendor": null,
          "fulfillment_service": "manual",
          "price": "199.00",
          "product_id": 632910392,
          "taxable": true,
          "requires_shipping": true,
          "gift_card": false,
          "name": "IPod Nano - 8gb - green",
          "variant_inventory_management": "bizweb",
          "properties": [
            {
              "name": "Custom Engraving Front",
              "value": "Happy Birthday"
            },
            {
              "name": "Custom Engraving Back",
              "value": "Merry Christmas"
            }
          ],
          "product_exists": true,
          "fulfillable_quantity": 1,
          "total_discount": "0.00",
          "fulfillment_status": null,
          "tax_lines": [
          ]
        },
        {
          "id": 518995019,
          "variant_id": 49148385,
          "title": "IPod Nano - 8gb",
          "quantity": 1,
          "grams": 200,
          "sku": "IPOD2008RED",
          "variant_title": "red",
          "vendor": null,
          "fulfillment_service": "manual",
          "price": "199.00",
          "product_id": 632910392,
          "taxable": true,
          "requires_shipping": true,
          "gift_card": false,
          "name": "IPod Nano - 8gb - red",
          "variant_inventory_management": "bizweb",
          "properties": [
          ],
          "product_exists": true,
          "fulfillable_quantity": 1,
          "total_discount": "0.00",
          "fulfillment_status": null,
          "tax_lines": [
          ]
        },
        {
          "id": 703073504,
          "variant_id": 457924702,
          "title": "IPod Nano - 8gb",
          "quantity": 1,
          "grams": 200,
          "sku": "IPOD2008BLACK",
          "variant_title": "black",
          "vendor": null,
          "fulfillment_service": "manual",
          "price": "199.00",
          "product_id": 632910392,
          "taxable": true,
          "requires_shipping": true,
          "gift_card": false,
          "name": "IPod Nano - 8gb - black",
          "variant_inventory_management": "bizweb",
          "properties": [
          ],
          "product_exists": true,
          "fulfillable_quantity": 1,
          "total_discount": "0.00",
          "fulfillment_status": null,
          "tax_lines": [
          ]
        }
      ],
      "shipping_lines": [
        {
          "title": "Free Shipping",
          "price": "0.00",
          "code": "Free Shipping",
          "source": "bizweb",
          "tax_lines": [
          ]
        }
      ],
      "billing_address": {
        "first_name": "Bob",
        "address1": "123 Amoebobacterieae St",
        "phone": "(555)555-5555",
        "city": "Ottawa",
        "zip": "K2P0V6",
        "province": "Ontario",
        "country": "Canada",
        "last_name": "Bobsen",
        "address2": "",
        "company": "",
        "latitude": 45.41634,
        "longitude": -75.6868,
        "name": "Bob Bobsen",
        "country_code": "CA",
        "province_code": "ON"
      },
      "shipping_address": {
        "first_name": "Bob",
        "address1": "123 Amoebobacterieae St",
        "phone": "(555)555-5555",
        "city": "Ottawa",
        "zip": "K2P0V6",
        "province": "Ontario",
        "country": "Canada",
        "last_name": "Bobsen",
        "address2": "",
        "company": "",
        "latitude": 45.41634,
        "longitude": -75.6868,
        "name": "Bob Bobsen",
        "country_code": "CA",
        "province_code": "ON"
      },
      "fulfillments": [
        {
          "id": 255858046,
          "order_id": 450789469,
          "status": "failure",
          "created_on": "2015-09-02T14:52:34Z",
          "service": "manual",
          "modified_on": "2015-09-02T14:52:34Z",
          "tracking_company": null,
          "tracking_number": "1Z2345",
          "tracking_numbers": [
            "1Z2345"
          ],
          "tracking_url": "http:\/\/wwwapps.ups.com\/etracking\/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track",
          "tracking_urls": [
            "http:\/\/wwwapps.ups.com\/etracking\/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track"
          ],
          "receipt": {
            "testcase": true,
            "authorization": "123456"
          },
          "line_items": [
            {
              "id": 466157049,
              "variant_id": 39072856,
              "title": "IPod Nano - 8gb",
              "quantity": 1,
              "grams": 200,
              "sku": "IPOD2008GREEN",
              "variant_title": "green",
              "vendor": null,
              "fulfillment_service": "manual",
              "price": "199.00",
              "product_id": 632910392,
              "taxable": true,
              "requires_shipping": true,
              "gift_card": false,
              "name": "IPod Nano - 8gb - green",
              "variant_inventory_management": "bizweb",
              "properties": [
                {
                  "name": "Custom Engraving Front",
                  "value": "Happy Birthday"
                },
                {
                  "name": "Custom Engraving Back",
                  "value": "Merry Christmas"
                }
              ],
              "product_exists": true,
              "fulfillable_quantity": 1,
              "total_discount": "0.00",
              "fulfillment_status": null,
              "tax_lines": [
              ]
            }
          ]
        }
      ],
      "client_details": {
        "browser_ip": "0.0.0.0",
        "accept_language": null,
        "user_agent": null,
        "session_hash": null,
        "browser_width": null,
        "browser_height": null
      },
      "refunds": [
        {
          "id": 509562969,
          "order_id": 450789469,
          "created_on": "2015-09-02T14:52:34Z",
          "note": "it broke during shipping",
          "restock": true,
          "user_id": 799407056,
          "refund_line_items": [
            {
              "id": 104689539,
              "quantity": 1,
              "line_item_id": 703073504,
              "line_item": {
                "id": 703073504,
                "variant_id": 457924702,
                "title": "IPod Nano - 8gb",
                "quantity": 1,
                "grams": 200,
                "sku": "IPOD2008BLACK",
                "variant_title": "black",
                "vendor": null,
                "fulfillment_service": "manual",
                "price": "199.00",
                "product_id": 632910392,
                "taxable": true,
                "requires_shipping": true,
                "gift_card": false,
                "name": "IPod Nano - 8gb - black",
                "variant_inventory_management": "bizweb",
                "properties": [
                ],
                "product_exists": true,
                "fulfillable_quantity": 1,
                "total_discount": "0.00",
                "fulfillment_status": null,
                "tax_lines": [
                ]
              }
            },
            {
              "id": 709875399,
              "quantity": 1,
              "line_item_id": 466157049,
              "line_item": {
                "id": 466157049,
                "variant_id": 39072856,
                "title": "IPod Nano - 8gb",
                "quantity": 1,
                "grams": 200,
                "sku": "IPOD2008GREEN",
                "variant_title": "green",
                "vendor": null,
                "fulfillment_service": "manual",
                "price": "199.00",
                "product_id": 632910392,
                "taxable": true,
                "requires_shipping": true,
                "gift_card": false,
                "name": "IPod Nano - 8gb - green",
                "variant_inventory_management": "bizweb",
                "properties": [
                  {
                    "name": "Custom Engraving Front",
                    "value": "Happy Birthday"
                  },
                  {
                    "name": "Custom Engraving Back",
                    "value": "Merry Christmas"
                  }
                ],
                "product_exists": true,
                "fulfillable_quantity": 1,
                "total_discount": "0.00",
                "fulfillment_status": null,
                "tax_lines": [
                ]
              }
            }
          ],
          "transactions": [
            {
              "id": 179259969,
              "order_id": 450789469,
              "kind": "refund",
              "gateway": "bogus",
              "message": null,
              "created_on": "2005-08-05T12:59:12Z",
              "test": false,
              "authorization": "authorization-key",
              "status": "success",
              "amount": "209.00",
              "currency": "USD",
              "location_id": null,
              "user_id": null,
              "parent_id": null,
              "device_id": null,
              "receipt": {},
              "error_code": null,
              "source_name": "web"
            }
          ]
        }
      ],
      "payment_details": {
        "credit_card_bin": null,
        "avs_result_code": null,
        "cvv_result_code": null,
        "credit_card_number": "•••• •••• •••• 4242",
        "credit_card_company": "Visa"
      },
      "customer": {
        "id": 207119551,
        "email": "[email protected]",
        "accepts_marketing": false,
        "created_on": "2015-09-02T14:52:34Z",
        "modified_on": "2015-09-02T14:52:34Z",
        "first_name": "Bob",
        "last_name": "Norman",
        "orders_count": 1,
        "state": "disabled",
        "total_spent": "41.94",
        "last_order_id": 450789469,
        "note": null,
        "verified_email": true,
        "multipass_identifier": null,
        "tax_exempt": false,
        "tags": "",
        "last_order_name": "#1001",
        "default_address": {
          "id": 207119551,
          "first_name": null,
          "last_name": null,
          "company": null,
          "address1": "Chestnut Street 92",
          "address2": "",
          "city": "Louisville",
          "province": "Kentucky",
          "country": "United States",
          "zip": "40202",
          "phone": "555-625-1199",
          "name": "",
          "province_code": "KY",
          "country_code": "US",
          "country_name": "United States",
          "primary": true
        }
      }
    }
  ]
}

Bài viết trên có hữu ích cho bạn không?

Hữu ích Không hữu ích
Số lượt đánh giá hữu ích: