Chuyển tới nội dung chính

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"
}
ParameterTypeDefaultNullableRequire\tDescription
method_idintegerPhương thức thanh toán
amountdoubleĐịnh danh phiếu
descriptionstringMô tả
pay_datedateNgà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​

ParameterTypeDefaultNullableRequire\tDescription
descriptionstringMô tả
payment_sheet_idintegerĐịnh danh phiếu
amountnumericSố tiền
pointnumericSố điểm
method_idintegerĐịnh danh phương thức
pay_datetimestampNgà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​

ParameterTypeDefaultNullableRequire\tDescription
sheet_descriptionstringMô tả
sheet_datetimestampyesNgày nhập/xuất
sheet_amountfloatSố tiền
sheet_paymentintegeryesHình thức thanh toán
sheet_sourceintegeryesNguồn phiếu
sheet_titlestringyesTiêu đề
fund_idintegeryesĐịnh danh quỹ
user_idintegeryesĐịnh danh người tạo
payment_slip_receiverstringTên người nộp tiền
order_idintegeryesĐị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​

FieldTypeDescription
payment_idintegerID của thanh toán
order_idintegerID của đơn hàng
user_idintegerID của người dùng
user_namestringTên người dùng
descriptionstringMô tả thanh toán
payment_sheet_idintegerID phiếu thanh toán (nếu có)
amountnumericSố tiền thanh toán
pointnumericSố điểm sử dụng
method_idintegerID phương thức thanh toán
method_namestringTên phương thức thanh toán
pay_datetimestampNgày thanh toán
created_attimestampNgày tạo giao dịch
updated_attimestampNgày cập nhật giao dịch

Filtering​

FieldsSupportTypeDescription
ideq,inintegerĐịnh danh
order_dategte,lte,eq,betweentimestampNgày đặt hàng
created_ateq,gte,lte,betweentimestampNgày tạo đơn
updated_ateq,gte,lte,betweentimestampNgày sửa đơn

Sort​

Sort (field)Direction
idasc,desc
pay_dateasc,desc
created_atasc,desc
updated_atasc,desc

Limit & Offset​

TypeDescription
LimitLấy bao nhiêu bản ghi
OffsetBỏ 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"
}
}