Charge Schedule API

การทำงานของ Charge Schedule API คือช่วยสร้าง, เรียกข้อมูล หรือลบรายการรับชำระเงินที่ได้มีการตั้งล่วงหน้าเอาไว้ด้วย schedule เมื่อต้องการตั้งรายการรับชำระเงินล่วงหน้าใหม่ ให้สร้าง schedule และเพิ่ม object นี้ใน field charge. สำหรับการใช้งาน Schedule API นั้น จะไม่สามารถใช้งานได้กับบัญชีที่เปิดใช้งาน 3-D Secure ณ ขณะนี้

Attribute

Name Type Description
amount integer

Amount for charge schedule in smallest currency unit.

card card

The CARD_ID to be charged. Empty in case the default_card of CUSTOMER_ID is charged.

currency string

Currency for charge schedule as three-letter ISO 4217 code.

customer object_id

The CUSTOMER_ID to be charged.

description string

Description of the charge schedule.

Example

  • Json Response

List all charge schedules

- GET https://api.omise.co/charges/schedules

Returns a list of all charge_schedule objects belonging to your account.

Request Parameter

Name Type Description
offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

limit integer

(optional, default: 20, maximum: 100) Number of records to return.

from datetime

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC date and time for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

to datetime

(optional, default: current UTC datetime) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

order string

(optional, default: chronological) Order in which to return records. One of chronological (earliest to latest) or reverse_chronological (latest to earliest).

Example

  • List all charge schedules

List all charge schedules for a given customer

- GET https://api.omise.co/customers/CUSTOMER_ID/schedules

Returns a list of schedule objects. Returns all charge schedules that belong to a given customer.

Request Parameter

Name Type Description
offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

limit integer

(optional, default: 20, maximum: 100) Number of records to return.

from datetime

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC date and time for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

to datetime

(optional, default: current UTC datetime) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

order string

(optional, default: chronological) Order in which to return records. One of chronological (earliest to latest) or reverse_chronological (latest to earliest).

Example

  • List all charge schedules for a customer.

Retrieve a charge schedule

- GET https://api.omise.co/schedules/SCHEDULE_ID

See schedules documentation for more information.

Create a charge schedule

- POST https://api.omise.co/schedules

Creates and returns a new charge schedule object. Note: this endpoint is not available for 3DS-enabled accounts. If you have a 3DS-enabled account, please create a new account to use this feature.

Request Parameter

Name Type Description
every integer

How often the schedule runs. E.g.: Every 3 weeks.

period string

day, week or month. E.g.: Every 3 weeks.

on on

The on object has the following structure based on the value of period:

  • If period is day, omit on object entirely.
  • If period is week, on object has following structure: { weekdays: [''Monday'', ''Wednesday''] }.
  • If period is month, on object has one of two structures:
    • { days_of_month: [1, 15, 20] } (1 through 28 only)
    • { weekday_of_month: "second_monday" }.
start_date date

When the schedule should start, in ISO 8601 format (YYYY-MM-DD). Defaults to today.

end_date date

When the schedule should end, in ISO 8601 format (YYYY-MM-DD).

charge charge_schedule
  • amount: The amount to be charged
  • currency: The currency to be used for said charge.
  • description: The description that is applied to all charges created by this schedule.
  • customer: The customer ID to be charged.
  • card: The card uid to be charged. Empty in case the default card is charged.

Example

  • Charge to a specific customer every 2 days

  • Charge every Monday and Friday

  • Charge on the 1st, 10th and 15th every 3 months

  • Charge on the second Monday every month

Destroy a charge schedule

- DELETE https://api.omise.co/schedules/SCHEDULE_ID

See schedules documentation for more information.