Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sdk.qfapi.com/llms.txt

Use this file to discover all available pages before exploring further.

This page documents the available API endpoints for recurring payments. Make sure you have read the Recurring Overview before using these APIs.

1. Create Customer

POST /customer/v1/create Creates a new customer profile.

Request Parameters

ParameterTypeRequiredDescription
nameStringNoCustomer name
phoneStringNoContact number
emailStringNoEmail address
billing_addressString (JSON)NoJSON string of billing address

Response

Returns the customer_id.

2. Update Customer

POST /customer/v1/update Updates an existing customer.

Request Parameters

ParameterTypeRequiredDescription
customer_idStringYesQFPay system customer ID
nameStringNoCustomer name
phoneStringNoContact number
emailStringNoEmail address
billing_addressJSONNoJSON object of billing address

Response

Returns number of affected rows.

3. Query Customers

POST /customer/v1/query Search for customers.

Request Parameters

ParameterTypeRequiredDescription
customer_idStringNoCustomer ID
nameStringNoCustomer name
phoneStringNoContact number
emailStringNoEmail address
pageIntNoDefault = 1
page_sizeIntNoDefault = 10, max = 100

Response

List of matching customers.

4. Delete Customer

POST /customer/v1/delete Deletes a customer. This action is irreversible.

Request Parameters

ParameterTypeRequiredDescription
customer_idStringYesCustomer ID to delete

Response

Returns deleted customer ID and row count.

5. Create Product

POST /product/v1/create Creates a recurring billing product.

Request Parameters

ParameterTypeRequiredDescription
nameStringYesProduct name
typeStringYesMust be recurring
descriptionStringNoProduct description
txamtIntYesAmount in cents (100 = $1)
txcurrcdStringYesCurrency (e.g. HKD)
intervalStringYesBilling cycle: monthly, yearly, etc.
interval_countIntYesInterval count (e.g. 1 month = 1)
usage_typeStringYesMust be licensed
In the sandbox environment, minutes and hours can be used in the interval field for testing purposes.

Response

Returns generated product_id.

6. Update Product

POST /product/v1/update Updates product metadata.

Request Parameters

ParameterTypeRequiredDescription
product_idStringYesProduct ID to update
nameStringNoNew name
descriptionStringNoNew description

Response

Returns number of affected rows.

7. Query Products

POST /product/v1/query Search for products.

Request Parameters

ParameterTypeRequiredDescription
product_idStringNoProduct ID
nameStringNoProduct name
descriptionStringNoDescription
txcurrcdStringNoCurrency
intervalStringNomonthly / yearly
pageIntNoDefault = 1
page_sizeIntNoDefault = 10, max = 100

Response

List of matching products.

8. Delete Product

POST /product/v1/delete Deletes a product (must not be linked to active subscriptions).

Request Parameters

ParameterTypeRequiredDescription
product_idStringYesProduct ID to delete

Response

Returns deleted product ID and row count.

9. Create Subscription

You must create customer_id, product_id, and token_id before calling the subscription API.
POST /subscription/v1/create Creates a recurring subscription.

Request Parameters

ParameterTypeRequiredDescription
customer_idStringYesLinked customer ID
token_idStringYesLinked payment token
productsListYesProduct ID and quantity
total_billing_cyclesIntNoTotal billing periods (null = indefinite)
start_timeStringNoISO timestamp to start subscription

Products Object

AttributeTypeRequiredDescription
product_idStringYesUnique product identifier
quantityIntNoDefault = 1

Example Request

{
  "products": [
    {
      "product_id": "prod_54c3772d******9a54b236e09ec74f",
      "quantity": 1
    }
  ],
  "customer_id": "cust_aaf6aae94******982c54c9cae5ba32",
  "token_id": "tk_a99892fd*********d3417d168a18bb",
  "total_billing_cycles": 2,
  "start_time": "2020-05-14 12:32:56"
}

Response (data field)

AttributeTypeDescription
subscription_idStringUnique subscription identifier
stateStringACTIVE, INCOMPLETE, COMPLETED

10. Update Subscription

POST /subscription/v1/update

Request Parameters

AttributeTypeRequiredDescription
subscription_idStringYesUnique subscription ID
total_billing_cyclesIntNoNull = indefinite
start_timeStringNoFirst billing time
token_idStringNoPayment token
productsObjectNoList of product objects

Response (data field)

AttributeTypeDescription
subscription_idStringSubscription ID
rowAffectedIntNumber of records updated

11. Query Subscription

POST /subscription/v1/query

Request Parameters

AttributeTypeRequiredDescription
pageIntNoDefault = 1
page_sizeIntNoDefault = 10, max = 100
subscription_idStringNoSubscription ID
customer_idStringNoCustomer ID
stateStringNoe.g. INCOMPLETE, ACTIVE

Sample Response

{
  "resperr": "success",
  "respcd": "0000",
  "respmsg": "success",
  "data": [
    {
      "subscription_id": "sub_e120378de*******da066f690da75",
      "customer_id": "cust_5ba1539f*******c9bda11d12c854e36",
      "token_id": "tk_9ac510017*******69b614e8f7ee",
      "state": "ACTIVE",
      "total_billing_cycles": 3,
      "completed_iteration": 1,
      "last_billing_time": "2024-11-21T11:12:06Z",
      "next_billing_time": "2024-11-21T11:13:06Z",
      "products": [
        { "product_id": "prod_8efecd0bd******b9aa1ec5ec01", "quantity": 1 }
      ]
    }
  ]
}

12. Cancel Subscription

POST /subscription/v1/cancel

Request Parameters

AttributeTypeRequiredDescription
subscription_idStringYesSubscription ID

13. Query Subscription Orders

POST /subscription/billing_order/v1/list

Request Parameters

AttributeTypeRequiredDescription
subscription_idStringYesSubscription ID
pageIntNoDefault = 1
page_sizeIntNoDefault = 10, max = 100

Response (data field)

AttributeTypeDescription
subscription_order_idStringFormat: sub_ord_{subscription_id}_{0001}
subscription_idStringParent subscription
trigger_byStringauto or manual
sequence_noIntBilling iteration number

14. Manual Charge Subscription

POST /subscription/v1/charge

Request Parameters

AttributeTypeRequiredDescription
subscription_idStringYesSubscription ID
subscription_order_idStringNoSpecific order to retry
This API is only valid for subscriptions with failed billing and state UNPAID, INCOMPLETE, or PAST_DUE.
  • If manual charge occurs before next billing time → subscription remains ACTIVE
  • If manual charge occurs after next billing time → subscription will be cancelled
  • If manual charge fails → subscription state remains unchanged