Charge Schedule
การทำงานของ Charge Schedule API คือช่วยสร้าง, เรียกข้อมูล
หรือลบรายการรับชำระเงินที่ได้มีการตั้งล่วงหน้าเอาไว้ด้วย
schedule เมื่อต้องการตั้งรายการรับชำระเงินล่วงหน้าใหม่
ให้สร้าง schedule และเพิ่ม object นี้ใน field charge
.
สำหรับการใช้งาน Schedule API นั้น จะไม่สามารถใช้งานได้กับบัญชีที่เปิดใช้งาน 3-D Secure ณ ขณะนี้
Attributes
Name | Type | Description |
---|---|---|
object | string | The string |
id | string | The scheduled charge identifier matching |
livemode | boolean | Whether this is a live ( |
amount | integer | Scheduled charge amount in smallest unit of charge currency. |
card | object_id_expandable | Identifier for card to be charged. If a card was not specified at charge schedule creation, this is the customer's current default card. |
created_at | string | UTC datetime of scheduled charge creation in ISO 8601 format ( |
currency | string | Currency for scheduled charge as three-letter ISO 4217 code. |
customer | object_id_expandable | Identifier for customer to be charged. |
default_card | boolean | Whether |
description | string | Scheduled charge description. |
metadata | object | Custom metadata (e.g. |
Example
-
JSON Response
{ "object": "scheduled_charge", "id": "rchg_test_no1t4tnemucod0e51mo", "livemode": false, "currency": "THB", "amount": 12345, "default_card": true, "card": "card_test_no1t4tnemucod0e51mo", "customer": "cust_test_no1t4tnemucod0e51mo", "description": "Subscription for coffee beans", "metadata": { "answer": 42 }, "created_at": "2019-12-31T12:59:59Z" }
List charge schedules
- GET https://api.omise.co/charges/schedulesReturns a list of charge schedules belonging to your account.
Request Parameters
Name | Type | Description |
---|---|---|
from | string | (optional, default: |
limit | integer | (optional, default: |
offset | integer | (optional, default: |
order | string | (optional, default: |
to | string | (optional) Latest UTC datetime for returned records in ISO 8601 format ( |
Example
-
List all charge schedules
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/charges/schedules \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $schedules = OmiseCharge::schedules();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.charges.schedules(); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" schedules = Omise::Charge.schedules
var schedules = await Client .Charges .Schedules .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total charge schedules: {schedules.Total}");
Request<ScopedList<Schedule>> request = new Schedule.ChargeScheduleListRequestBuilder().build(); ScopedList<Schedule> schedules = client().sendRequest(request); System.out.printf("Total no. of charge schedules: %d", schedules.getTotal());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Charge.schedule()
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ScheduleList{} err := client.Do(result, &operations.ListChargeSchedules{ List: operations.List{ Limit: 100, From: time.Now().Add(-1 * time.Hour), }, }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Charge.list_schedules