Thanh toán
Thanh toán đơn hàng trên Getfly
Phương thức thanh toán
Lấy ra danh sách các phương thức thanh toán trên hệ thống
HTTP Request
GET /api/v6/payment_methods?fields=method_name
Response
{
"data": [
{ "id":1, "method_name": "Tiền mặt" },
{ "id":2, "method_name": "Chuyển khoản" }
]
}
Thanh toán đơn hàng trực tiếp
Đối với trường hợp không dùng module Quỹ
Http Request
POST /api/v6/sale_orders/{{order_id}}/paid
Trong đó order_id là ID đơn hàng trên hệ thống Getfly
Body Parameters
{
"description": "Thanh toán đơn hàng DH001.000",
"amount": 2000000,
"method_id": 1,
"pay_date": "2024-09-16"
}
Parameter | Type | Default | Nullable | Require | \tDescription |
---|---|---|---|---|---|
method_id | integer | Phương thức thanh toán | |||
amount | double | Định danh phiếu | |||
description | string | Mô tả | |||
pay_date | date | Ngày thanh toán (Y-m-d) |
Thanh toán đơn hàng bán bằng điểm
Đối với trường hợp không dùng chức năng Quỹ
HTTP Request
[POST] /api/v6/sale_orders/{id}/pay_via_point
Query Parameters
Parameter | Type | Default | Nullable | Require | \tDescription |
---|---|---|---|---|---|
description | string | Mô tả | |||
payment_sheet_id | integer | Định danh phiếu | |||
amount | numeric | Số tiền | |||
point | numeric | Số điểm | |||
method_id | integer | Định danh phương thức | |||
pay_date | timestamp | Ngày thanh toán |
Example
HTTP Request
PUT api/v6/sale_orders/1588/pay_via_point HTTP/1.1
Host: example.getflycrm.com
Status
200 OK
Response
{
"message": "Cập nhật thành công"
}
Thanh toán đơn hàng bán theo phiếu thu/chi
Đối với trường hợp dùng chức năng Quỹ
HTTP Request
[POST] /api/v6/sale_orders/pay_via_fund
Body Parameters
Parameter | Type | Default | Nullable | Require | \tDescription |
---|---|---|---|---|---|
sheet_description | string | Mô tả | |||
sheet_date | timestamp | yes | Ngày nhập/xuất | ||
sheet_amount | float | Số tiền | |||
sheet_payment | integer | yes | Hình thức thanh toán | ||
sheet_source | integer | yes | Nguồn phiếu | ||
sheet_title | string | yes | Tiêu đề | ||
fund_id | integer | yes | Định danh quỹ | ||
user_id | integer | yes | Định danh người tạo | ||
payment_slip_receiver | string | Tên người nộp tiền | |||
order_id | integer | yes | Định danh đơn hàng |
Example
HTTP Request
PUT api/v6/sale_orders/pay_via_fund HTTP/1.1
Host: example.getflycrm.com
Content-Type: application/json
{
"sheet_date": 1701229899,
"sheet_amount": 100,
"sheet_payment": 1,
"sheet_source": 1,
"sheet_title": "Tiêu đề",
"fund_id": 1,
"user_id": 1,
"order_id": 1,
}
Status
200 OK
Response
{
"message": "Thêm mới thành công",
"id": 4
}
Danh sách lịch sử thanh toán
Lấy danh sách lịch sử thanh toán của một đơn hàng cụ thể.
HTTP Request
GET /api/v6/sale_order_payments
Trong đó order_id
là ID của đơn hàng trên hệ thống Getfly.
Fields
Field | Type | Description |
---|---|---|
payment_id | integer | ID của thanh toán |
order_id | integer | ID của đơn hàng |
user_id | integer | ID của người dùng |
user_name | string | Tên người dùng |
description | string | Mô tả thanh toán |
payment_sheet_id | integer | ID phiếu thanh toán (nếu có) |
amount | numeric | Số tiền thanh toán |
point | numeric | Số điểm sử dụng |
method_id | integer | ID phương thức thanh toán |
method_name | string | Tên phương thức thanh toán |
pay_date | timestamp | Ngày thanh toán |
created_at | timestamp | Ngày tạo giao dịch |
updated_at | timestamp | Ngày cập nhật giao dịch |
Filtering
Fields | Support | Type | Description |
---|---|---|---|
id | eq,in | integer | Định danh |
order_date | gte,lte,eq,between | timestamp | Ngày đặt hàng |
created_at | eq,gte,lte,between | timestamp | Ngày tạo đơn |
updated_at | eq,gte,lte,between | timestamp | Ngày sửa đơn |
Sort
Sort (field) | Direction |
---|---|
id | asc,desc |
pay_date | asc,desc |
created_at | asc,desc |
updated_at | asc,desc |
Limit & Offset
Type | Description |
---|---|
Limit | Lấy bao nhiêu bản ghi |
Offset | Bỏ qua bao nhiêu bản ghi |
Example
GET /api/v6/sale_order_payments?fields=payment_id%2Corder_id%2Cuser_id%2Cuser_name%2Cdescription%2Cpayment_sheet_id%2Camount%2Cpoint%2Cmethod_id%2Cmethod_name%2Cpay_date%2Ccreated_at%2Cupdated_at&filtering[order_id]=88&sort=pay_date&direction=desc
Response
{
"data": [
{
"id": 24,
"order_id": 88,
"user_id": 2,
"user_name": "Nguyễn Văn A",
"description": "",
"payment_sheet_id": 24,
"amount": 40000,
"point": 0,
"method_id": 1,
"method_name": "Tiền mặt",
"pay_date": "2025-01-21 11:56:15",
"created_at": "2025-01-21 11:56:15",
"updated_at": "2025-01-21 11:56:15"
},
{
"id": 23,
"order_id": 88,
"user_id": 2,
"user_name": "Nguyễn Văn A",
"description": "Dubidi",
"payment_sheet_id": null,
"amount": 15000,
"point": 0,
"method_id": 1,
"method_name": "Tiền mặt",
"pay_date": "2025-01-21 11:54:36",
"created_at": "2025-01-21 11:54:36",
"updated_at": "2025-01-21 11:54:36"
}
],
"has_more": false,
"offset": 0,
"limited": 20,
"sorted": {
"pay_date": "DESC"
}
}