Skip to main content

Payment

Order payment on Getfly

Payment Methods

Get a list of payment methods in the system

HTTP Request

GET /api/v6/payment_methods?fields=method_name

Response

{
"data": [
{ "id":1, "method_name": "Cash" },
{ "id":2, "method_name": "Bank Transfer" }
]
}

Direct Order Payment

For cases where the Fund module is not used

Http Request

POST /api/v6/sale_orders/{{order_id}}/paid

Where order_id is the order ID in the Getfly system

Body Parameters

{
"description": "Order payment DH001.000",
"amount": 2000000,
"method_id": 1,
"pay_date": "2024-09-16"
}
ParameterTypeDefaultNullableRequireDescription
method_idintegerPayment method
amountdoubleVoucher identifier
descriptionstringDescription
pay_datedatePayment date (Y-m-d)

Sales Order Payment by Points

For cases where the Fund function is not used

HTTP Request

[POST] /api/v6/sale_orders/{id}/pay_via_point

Query Parameters

ParameterTypeDefaultNullableRequireDescription
descriptionstringDescription
payment_sheet_idintegerVoucher identifier
amountnumericAmount
pointnumericPoints
method_idintegerMethod identifier
pay_datetimestampPayment date

Example

HTTP Request

PUT api/v6/sale_orders/1588/pay_via_point HTTP/1.1
Host: example.getflycrm.com

Status

200 OK

Response

{
"message": "Successfully updated"
}

Sales Order Payment via Receipt/Payment Voucher

For cases where the Fund function is used

HTTP Request

[POST] /api/v6/sale_orders/pay_via_fund

Body Parameters

| Parameter | Type | Default | Nullable | Require | Description |
|:----------------------|:---------:|:-------:|:--------:|:-------:|:---------------------|
| sheet_description | string | | | | Description |
| sheet_date | timestamp | | | yes | Entry/exit date |
| sheet_amount | float | | | | Amount |
| sheet_payment | integer | | | yes | Payment method |
| sheet_source | integer | | | yes | Voucher source |
| sheet_title | string | | | yes | Title |
| fund_id | integer | | | yes | Fund identifier |
| user_id | integer | | | yes | Creator identifier |
| payment_slip_receiver | string | | | | Payer |
| order_id | integer | | | yes | Order identifier |\

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": "Title",
"fund_id": 1,
"user_id": 1,
"order_id": 1,
}

Status

200 OK

Response

{
"message": "Successfully added",
"id": 4
}

List of payment history

Get the payment history list for a specific order.

HTTP Request

GET /api/v6/sale_order_payments

Where order_id is the order ID in the Getfly system.

Fields

| Field | Type | Description |
|:------------------|:---------:|:----------------------------------|
| payment_id | integer | Payment ID |
| order_id | integer | Order ID |
| user_id | integer | User ID |
| user_name | string | User name |
| description | string | Payment description |
| payment_sheet_id | integer | Payment voucher ID (if any) |
| amount | numeric | Payment amount |
| point | numeric | Points used |
| method_id | integer | Payment method ID |
| method_name | string | Payment method name |
| pay_date | timestamp | Payment date |
| created_at | timestamp | Transaction creation date |
| updated_at | timestamp | Transaction update date |\

Filtering

| Fields | Support | Type | Description |
|:--------------|:-------------------|:-----------|:---------------------|
| id | eq,in | integer | Identifier |
| order_date | gte,lte,eq,between | timestamp | Order date |
| created_at | eq,gte,lte,between | timestamp | Order creation date |
| updated_at | eq,gte,lte,between | timestamp | Order modification date |\

Sort

| Sort (field) | Direction |
|:-------------|:------------------|
| id | asc,desc |
| pay_date | asc,desc |
| created_at | asc,desc |
| updated_at | asc,desc |\

Limit & Offset

TypeDescription
LimitNumber of records to retrieve
OffsetNumber of records to skip

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": "Nguyen Van A",
"description": "",
"payment_sheet_id": 24,
"amount": 40000,
"point": 0,
"method_id": 1,
"method_name": "Cash",
"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": "Nguyen Van A",
"description": "Dubidi",
"payment_sheet_id": null,
"amount": 15000,
"point": 0,
"method_id": 1,
"method_name": "Cash",
"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"
}
}