Schedule(スケジュール)API
スケジュールAPIを利用することで、定期的に発生する予定のイベントをスケジュールとして事前に設定することができます。例えば、特定の顧客に対して毎月課金を作成したり,毎週月曜日に残高を指定の口座に振り込む等の設定を行うことができます。
Attributes
Name | Type | Description |
---|---|---|
object | string | 固定値 |
id | string |
|
livemode | boolean | 本番モード ( |
location | string | 現在の |
active | boolean | スケジュールのステータスが |
charge | charge_schedule | Charge schedule object(定期課金)。 |
created_at | string | ISO 8601 形式 ( |
deleted | boolean | スケジュールが削除されたかどうか。 |
end_on | string | ISO 8601 形式のスケジュール終了日。 |
ended_at | string | ISO 8601形式 ( |
every | integer | スケジュールの実行頻度を表す数値 |
in_words | string | スケジュールを英文で表した文字列。(例: |
next_occurrences_on | array | ISO 8601形式で示される最大30までのオカレンス予定日。 有効期限切れ、中断、または削除されたスケジュールの場合は空白となります。 |
occurrences | list | occurrence(オカレンス)オブジェクト list(リスト)。 |
on | object | スケジュールを指定するオブジェクト。 |
period | string |
|
start_on | string | ISO 8601形式のスケジュール開始日。 |
state | string | 定期課金が有効か一時停止かを示す |
status | string | 現在の定期課金の状況は以下のいずれかです。
|
transfer | transfer_schedule | Transfer schedule object(送金スケジュールオブジェクト)。 |
Example
-
JSON Response
{ "object": "schedule", "id": "schd_test_no1t4tnemucod0e51mo", "deleted": false, "livemode": false, "location": "/schedules/schd_test_no1t4tnemucod0e51mo", "every": 2, "occurrences": { "object": "list", "data": [], "limit": 20, "offset": 0, "total": 0, "location": "/schedules/schd_test_no1t4tnemucod0e51mo/occurrences", "order": "chronological", "from": "1970-01-01T00:00:00Z", "to": "2019-12-31T12:59:59Z" }, "on": {}, "in_words": "Every 2 day(s)", "period": "day", "status": "running", "active": true, "charge": { "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": null, "metadata": {}, "created_at": "2019-12-31T12:59:59Z" }, "next_occurrences_on": [ "2023-11-01", "2023-11-03", "2023-11-05", "2023-11-07", "2023-11-09", "2023-11-11", "2023-11-13", "2023-11-15", "2023-11-17", "2023-11-19", "2023-11-21", "2023-11-23", "2023-11-25", "2023-11-27", "2023-11-29", "2023-12-01", "2023-12-03", "2023-12-05", "2023-12-07", "2023-12-09", "2023-12-11", "2023-12-13", "2023-12-15", "2023-12-17", "2023-12-19", "2023-12-21", "2023-12-23", "2023-12-25", "2023-12-27", "2023-12-29" ], "ended_at": null, "start_on": "2023-11-01", "end_on": "2024-11-01", "created_at": "2019-12-31T12:59:59Z" }
スケジュールを作成
- POST https://api.omise.co/schedulesスケジュールを作成
注:Opn Paymentsダッシュボードから、複数のカードのデータを一括でアップロードし、複数の定期課金を自動作成することができます。
Request Parameters
Name | Type | Description |
---|---|---|
end_date | string | (必須) ISO 8601形式のスケジュール終了日。 |
every | integer | (必須) スケジュールの実行頻度を表す数値 |
period | string | (必須, one of: |
start_date | string | (必須) ISO 8601形式のスケジュール開始日。 |
charge | object | (任意、 場合によって必須) Charge schedule object(定期課金)。 |
on | object | (任意) スケジュールを指定するオブジェクト。 |
transfer | object | (任意、 場合によって必須) Transfer schedule object(送金スケジュールオブジェクト)。 |
Example
-
Cardを指定して2日毎に課金
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=2" \ -d "period=day" \ -d "start_date=2022-01-01" \ -d "end_date=2022-12-31" \ -d "charge[customer]=cust_test_5g0221fe8iwtayocgja" \ -d "charge[card]=card_test_5g021zls9ei5suyryss" \ -d "charge[amount]=100000" \ -d "charge[description]=Membership fee"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseCharge::schedule(array( 'customer' => 'cust_test_58e7b94d2wfmfn6p2x1', 'card' => 'card_test_58eeofcdwl5clmhtyf0', 'amount' => 100000, 'description' => 'Membership fee' )); $schedule = $scheduler->every(2) ->days() ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 2, period: 'day', start_date: '2025-05-01', end_date: '2026-05-01', charge: { customer: 'cust_test_no1t4tnemucod0e51mo', card: 'card_test_no1t4tnemucod0e51mo', amount: 100000, description: 'Membership fee', }, }); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" scheduler = Omise::Charge.schedule({ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee" }) schedule = scheduler.every(2).days .start_date("2017-05-01") .end_date("2018-05-01") .start
var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 2, Period = SchedulePeriod.Day, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { Weekdays = new[] { Weekdays.Monday } }, Charge = new ChargeScheduling { Amount = 2000, Currency = "thb", Customer = "cust_test_59gbtlbjldnc8651pmp", } }); Console.WriteLine($"created schedule: {schedule.Id}");
Schedule schedule = client.schedules() .create(new Schedule.Create() .every(2) .period(SchedulePeriod.day) .startDate(new DateTime(DateTime.parse("2017-05-01"))) .endDate(new DateTime(DateTime.parse("2018-05-01"))) .charge(new ChargeScheduling.Params() .customer("cust_test_57m2wcnfx96k634rkqq") .card("card_test_57m2w8iemdovs4f92m2") .amount(100000) .description("Membership fee") )); System.out.printf("created charge schedule: %s", schedule.getId());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.create( every=2, period="day", start_date="2021-05-01", end_date="2022-05-01", charge={ "customer": "cust_test_no1t4tnemucod0e51mo", "card": "card_test_no1t4tnemucod0e51mo", "amount": 100000, "description": "Membership fee", }, )
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.CreateChargeSchedule{ Every: 2, Period: schedule.PeriodDay, StartDate: "2024-05-01", EndDate: "2027-05-01", Customer: "cust_test_no1t4tnemucod0e51mo", Amount: 100000, Description: "Membership fee", }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 2, period: "day", start_date: "2017-05-01", end_date: "2018-05-01", charge: [ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee", ] )
-
2日ごとに定額を送金する
- curl
- php
- node.js
- C#
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=2" \ -d "period=day" \ -d "start_date=2022-01-01" \ -d "end_date=2022-12-31" \ -d "transfer[recipient]=recp_test_5g03h1x1mbpgxp8h1fh" \ -d "transfer[amount]=1000000"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseTransfer::schedule(array( 'recipient' => 'recp_test_586lkjci7y1h3a0uce3', 'amount' => 1000000 )); $schedule = $scheduler->every(2) ->days() ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 2, period: 'day', start_date: '2025-05-01', end_date: '2026-05-01', charge: { recipent: 'recp_test_no1t4tnemucod0e51mo', amount: 100000, }, }); console.log(schedule);
var recipient = RetrieveRecipient(); var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 2, Period = SchedulePeriod.Day, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), Transfer = new TransferScheduling { Amount = 200000, Recipient = recipient.Id, } }); Console.WriteLine($"created schedule: {schedule.Id}");
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.CreateTransferSchedule{ Every: 10, Period: schedule.PeriodDay, StartDate: "2024-02-27", EndDate: "2029-01-01", Recipient: "recp_test_no1t4tnemucod0e51mo", Amount: 1000000, }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 2, period: "day", start_date: "2017-05-01", end_date: "2018-05-01", transfer: [ recipient: "recp_test_57m2wcnfx96k634rkqq", amount: 1000000, ] )
-
3ヶ月毎に月内の1日、10日、15日に課金
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=3" \ -d "period=month" \ -d "on[days_of_month][]=1" \ -d "start_date=2025-01-01" \ -d "end_date=2025-12-31" \ -d "charge[customer]=cust_test_5g0221fe8iwtayocgja" \ -d "charge[amount]=100000" \ -d "charge[description]=Membership fee"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseCharge::schedule(array( 'customer' => 'cust_test_58e7b94d2wfmfn6p2x1', 'card' => 'card_test_58eeofcdwl5clmhtyf0', 'amount' => 100000, 'description' => 'Membership fee' )); $schedule = $scheduler->every(3) ->months(array(1)) ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 3, period: 'month', on: { days_of_month: [1], }, start_date: '2023-05-01', end_date: '2025-05-01', charge: { customer: 'cust_test_no1t4tnemucod0e51mo', amount: 100000, description: 'Membership fee', }, }); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" scheduler = Omise::Charge.schedule({ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee" }) schedule = scheduler.every(3).months(on: [1]) .start_date("2017-05-01") .end_date("2018-05-01") .start
var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 3, Period = SchedulePeriod.Month, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { DaysOfMonth = new[] { 1 } }, Charge = new ChargeScheduling { Amount = 2000, Currency = "thb", Customer = "cust_test_59gbtlbjldnc8651pmp", } }); Console.WriteLine($"created schedule: {schedule.Id}");
Schedule schedule = client.schedules() .create(new Schedule.Create() .every(3) .period(SchedulePeriod.month) .on(new ScheduleOn.Params() .daysOfMonth(1)) .startDate(new DateTime(DateTime.parse("2017-05-01"))) .endDate(new DateTime(DateTime.parse("2018-05-01"))) .charge(new ChargeScheduling.Params() .customer("cust_test_57m2wcnfx96k634rkqq") .amount(100000) .description("Membership fee") )); System.out.printf("created charge schedule: %s", schedule.getId());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.create( every=3, period="month", on={"days_of_month": [1]}, start_date="2021-05-01", end_date="2022-05-01", charge={ "customer": "cust_test_no1t4tnemucod0e51mo", "card": "card_test_no1t4tnemucod0e51mo", "amount": 100000, "description": "Membership fee", }, )
var schd omise.Schedule create := operations.CreateChargeSchedule{ Every: 3, Period: schedule.PeriodMonth, DaysOfMonth: schedule.DaysOfMonth{1}, StartDate: "2017-05-01", EndDate: "2018-05-01", Customer: "cust_test_57m2wcnfx96k634rkqq", Amount: 100000, Description: "Membership fee" } if e := client.Do(&schd, &create); e != nil { log.Fatalln(e) } log.Println("created schedule: %#v\n", schd)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 3, period: "month", on: [days_of_month: [1]], start_date: "2017-05-01", end_date: "2018-05-01", charge: [ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee", ] )
-
毎月の第2月曜日に課金
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=1" \ -d "period=month" \ -d "on[weekday_of_month]=2nd_monday" \ -d "start_date=2022-01-01" \ -d "end_date=2022-12-31" \ -d "charge[customer]=cust_test_5g0221fe8iwtayocgja" \ -d "charge[amount]=100000" \ -d "charge[description]=Membership fee"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseCharge::schedule(array( 'customer' => 'cust_test_58e7b94d2wfmfn6p2x1', 'card' => 'card_test_58eeofcdwl5clmhtyf0', 'amount' => 100000, 'description' => 'Membership fee' )); $schedule = $scheduler->every(1) ->months('2nd_monday') ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 1, period: 'month', on: { weekday_of_month: '2nd_monday', }, start_date: '2023-05-01', end_date: '2025-05-01', charge: { customer: 'cust_test_no1t4tnemucod0e51mo', amount: 100000, description: 'Membership fee', }, }); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" scheduler = Omise::Charge.schedule({ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee" }) schedule = scheduler.every(1).month(on: "2nd_monday") .start_date("2017-05-01") .end_date("2018-05-01") .start
var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 1, Period = SchedulePeriod.Month, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { WeekdayOfMonth = "2nd_monday" }, Charge = new ChargeScheduling { Amount = 2000, Currency = "thb", Customer = "cust_test_59gbtlbjldnc8651pmp", } }); Console.WriteLine($"created schedule: {schedule.Id}");
Schedule schedule = client.schedules() .create(new Schedule.Create() .every(1) .period(SchedulePeriod.month) .on(new ScheduleOn.Params() .weekdayOfMonth("2nd_monday")) .startDate(new DateTime(DateTime.parse("2017-05-01"))) .endDate(new DateTime(DateTime.parse("2018-05-01"))) .charge(new ChargeScheduling.Params() .customer("cust_test_57m2wcnfx96k634rkqq") .amount(100000) .description("Membership fee") )); System.out.printf("created charge schedule: %s", schedule.getId());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.create( every=1, period="month", on={"weekday_of_month": "2nd_monday"}, start_date="2021-05-01", end_date="2022-05-01", charge={ "customer": "cust_test_no1t4tnemucod0e51mo", "card": "card_test_no1t4tnemucod0e51mo", "amount": 100000, "description": "Membership fee", }, )
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.CreateChargeSchedule{ Every: 1, Period: schedule.PeriodMonth, WeekdayOfMonth: "2nd_monday", StartDate: "2027-05-01", EndDate: "2028-05-01", Customer: "cust_test_no1t4tnemucod0e51mo", Amount: 100000, Description: "Membership fee", }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 1, period: "month", on: [weekday_of_month: "2nd_monday"], start_date: "2017-05-01", end_date: "2018-05-01", charge: [ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee", ] )
-
毎月第2月曜日に残高全体を送金する
- curl
- php
- node.js
- C#
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=1" \ -d "period=month" \ -d "on[weekday_of_month]=2nd_monday" \ -d "start_date=2022-01-01" \ -d "end_date=2022-12-31" \ -d "transfer[recipient]=recp_test_5g03h1x1mbpgxp8h1fh"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseTransfer::schedule(array( 'recipient' => 'recp_test_586lkjci7y1h3a0uce3' )); $schedule = $scheduler->every(1) ->months('2nd_monday') ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 1, period: 'month', on: '2nd monday', start_date: '2025-05-01', end_date: '2026-05-01', charge: { recipent: 'recp_test_no1t4tnemucod0e51mo', description: 'Membership fee', }, }); console.log(schedule);
var recipient = RetrieveRecipient(); var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 1, Period = SchedulePeriod.Month, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { WeekdayOfMonth = "2nd_monday" }, Transfer = new TransferScheduling { Recipient = recipient.Id, }, }); Console.WriteLine($"created schedule: {schedule.Id}");
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.CreateTransferSchedule{ Every: 1, Period: schedule.PeriodMonth, WeekdayOfMonth: "2nd_monday", StartDate: "2027-05-01", EndDate: "2028-05-01", Recipient: "recp_test_no1t4tnemucod0e51mo", }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 1, period: "month", on: [weekday_of_month: "2nd_monday"], start_date: "2017-05-01", end_date: "2018-05-01", transfer: [ recipient: "recp_test_57m2wcnfx96k634rkqq", ] )
-
3ヶ月毎、1日、10日、15日に残高全体を送金する
- curl
- php
- C#
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=3" \ -d "period=month" \ -d "on[days_of_month][]=1" \ -d "start_date=2025-01-01" \ -d "end_date=2026-12-31" \ -d "transfer[recipient]=recp_test_5tm9g9o8k5qwu5qe4ql"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseTransfer::schedule(array( 'recipient' => 'recp_test_586lkjci7y1h3a0uce3' )); $schedule = $scheduler->every(3) ->months(array(1)) ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
var recipient = RetrieveRecipient(); var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 3, Period = SchedulePeriod.Month, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { DaysOfMonth = new[] { 1 } }, Transfer = new TransferScheduling { Recipient = recipient.Id, } }); Console.WriteLine($"created schedule: {schedule.Id}");
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.CreateTransferSchedule{ Every: 3, Period: schedule.PeriodMonth, DaysOfMonth: schedule.DaysOfMonth{1}, StartDate: "2027-05-01", EndDate: "2028-05-01", Recipient: "recp_test_no1t4tnemucod0e51mo", }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 3, period: "month", on: [days_of_month: [1], start_date: "2017-05-01", end_date: "2018-05-01", transfer: [ recipient: "recp_test_57m2wcnfx96k634rkqq", ] )
-
毎週月曜日と金曜日に課金
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=1" \ -d "period=week" \ -d "on[weekdays][]=monday" \ -d "on[weekdays][]=friday" \ -d "start_date=2025-01-01" \ -d "end_date=2025-12-31" \ -d "charge[customer]=cust_test_5g0221fe8iwtayocgja" \ -d "charge[amount]=100000" \ -d "charge[description]=Membership fee"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseCharge::schedule(array( 'customer' => 'cust_test_58e7b94d2wfmfn6p2x1', 'card' => 'card_test_58eeofcdwl5clmhtyf0', 'amount' => 100000, 'description' => 'Membership fee' )); $schedule = $scheduler->every(1) ->weeks(array('monday', 'friday')) ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 1, period: 'week', on: { weekdays: ['monday', 'friday'], }, start_date: '2023-05-01', end_date: '2025-04-01', charge: { customer: 'cust_test_no1t4tnemucod0e51mo', amount: 100000, description: 'Membership fee', }, }); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" scheduler = Omise::Charge.schedule({ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee" }) schedule = scheduler.every(1).week(on: ["monday", "friday"]) .start_date("2017-05-01") .end_date("2018-05-01") .start
var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 1, Period = SchedulePeriod.Week, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { Weekdays = new[] { Weekdays.Monday, Weekdays.Friday } }, Charge = new ChargeScheduling { Amount = 2000, Currency = "thb", Customer = "cust_test_59gbtlbjldnc8651pmp", } }); Console.WriteLine($"created schedule: {schedule.Id}");
Schedule schedule = client.schedules() .create(new Schedule.Create() .every(1) .period(SchedulePeriod.week) .on(new ScheduleOn.Params() .weekdays(Weekdays.Monday, Weekdays.Friday)) .startDate(new DateTime(DateTime.parse("2017-05-01"))) .endDate(new DateTime(DateTime.parse("2018-04-01"))) .charge(new ChargeScheduling.Params() .customer("cust_test_57m2wcnfx96k634rkqq") .amount(100000) .description("Membership fee") )); System.out.printf("created charge schedule: %s", schedule.getId());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.create( every=1, period="week", on={"weekdays": ["monday", "friday"]}, start_date="2021-05-01", end_date="2022-05-01", charge={ "customer": "cust_test_no1t4tnemucod0e51mo", "card": "card_test_no1t4tnemucod0e51mo", "amount": 100000, "description": "Membership fee", }, )
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.CreateChargeSchedule{ Every: 1, Period: schedule.PeriodWeek, Weekdays: schedule.Weekdays{ schedule.Monday, schedule.Friday, }, StartDate: "2027-05-01", EndDate: "2028-05-01", Customer: "cust_test_no1t4tnemucod0e51mo", Amount: 100000, Description: "Membership fee", }) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 1, period: "week", on: [weekdays: ["monday", "friday"]], start_date: "2017-05-01", end_date: "2018-05-01", charge: [ customer: "cust_test_57m2wcnfx96k634rkqq", card: "card_test_57m2w8iemdovs4f92m2", amount: 100000, description: "Membership fee", ] )
-
残高割合を毎週月曜日と金曜日に送金する
- curl
- php
- node.js
- C#
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY: \ -d "every=1" \ -d "period=week" \ -d "on[weekdays][]=monday" \ -d "on[weekdays][]=friday" \ -d "start_date=2025-01-01" \ -d "end_date=2025-12-31" \ -d "transfer[recipient]=rrecp_test_5tm9g9o8k5qwu5qe4ql" \ -d "transfer[percentage_of_balance]=75"
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $scheduler = OmiseTransfer::schedule(array( 'recipient' => 'recp_test_586lkjci7y1h3a0uce3', 'percentage_of_balance' => 75 )); $schedule = $scheduler->every(1) ->weeks(array('monday', 'friday')) ->startDate('2017-09-17') ->endDate('2018-09-17') ->start();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.create({ every: 1, period: 'week', on: { weekdays: ['monday', 'friday'], }, start_date: '2025-05-01', end_date: '2026-05-01', charge: { recipient: 'recp_test_no1t4tnemucod0e51mo', transfer: 75, description: 'Membership fee', }, }); console.log(schedule);
var recipient = RetrieveRecipient(); var schedule = await Client.Schedules.Create(new CreateScheduleRequest { Every = 1, Period = SchedulePeriod.Week, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2), On = new ScheduleOnRequest { Weekdays = new[] { Weekdays.Monday, Weekdays.Friday } }, Transfer = new TransferScheduling { PercentageOfBalance = 75.0f, Recipient = recipient.Id, } }); Console.WriteLine($"created schedule: {schedule.Id}");
var schd omise.Schedule create = operations.CreateTransferSchedule{ Every: 1, Period: schedule.PeriodWeek, Weekdays: schedule.Weekdays{ schedule.Monday, schedule.Friday, }, StartDate: "2017-05-01", EndDate: "2018-04-01", Recipient: "recp_test_57m2wcnfx96k634rkqq", PercentageOfBalance: 75, } if e := client.Do(&schd, &create); e != nil { panic(e) } fmt.Println("Create a weekly partial transfer schedule:", schd.ID)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.create( every: 1, period: "week", on: [weekdays: ["monday", "friday"]], start_date: "2017-05-01", end_date: "2018-05-01", transfer: [ recipient: "recp_test_57m2wcnfx96k634rkqq", percentage_of_balance: 75, ] )
スケジュールを削除
- DELETE https://api.omise.co/schedules/{id}Schedule IDで指定された特定のスケジュールが返り、そのデータは削除されます。
Example
-
スケジュールを削除
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules/schd_test_5g022yhk1zcvkf7zbt7 \ -X DELETE \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $schedule = OmiseSchedule::retrieve('schd_test_58et0oz1hmczg8foppb'); $schedule->destroy();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.destroy('schd_test_no1t4tnemucod0e51mo'); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" schedule = Omise::Schedule.retrieve("schd_test_4xsjvylia03ur542vn6") schedule.destroy schedule.destroyed? # => true
var schedule = RetrieveSchedule(); schedule = await Client.Schedules.Destroy(schedule.Id); Console.WriteLine($"disabled schedule: {schedule.Id} ({schedule.Deleted})");
Request<Schedule> request = new Schedule.DeleteRequestBuilder("schd_test_57s33hm9fg1pzcqihxs").build(); Schedule schedule = client().sendRequest(request); System.out.printf("Destroyed schedule: %s", schedule.getId());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.retrieve("schd_test_no1t4tnemucod0e51mo") schedule.destroy() schedule.destroyed # => true
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.DestroySchedule{ScheduleID: "schd_test_no1t4tnemucod0e51mo"}) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.destroy("schd_test_4xsjvylia03ur542vn6")
全てのスケジュールのリストを取得
- GET https://api.omise.co/schedulesscheduleに属するすべての お客様のアカウントオブジェクトの list を返します。
Request Parameters
Name | Type | Description |
---|---|---|
from | string | (任意, default: |
limit | integer | (任意, default: |
offset | integer | (任意, default: |
order | string | (任意, default: |
to | string | (任意) ISO 8601形式 ( |
Example
-
全てのスケジュールのリストを取得
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $schedules = OmiseSchedule::retrieve();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.retrieve(); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" schedules = Omise::Schedule.list
var schedules = await Client.Schedules.GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total schedules: {schedules.Total}");
Request<ScopedList<Schedule>> request = new Schedule.ListRequestBuilder().build(); ScopedList<Schedule> schedules = client().sendRequest(request); System.out.printf("Total no. of schedules: %d", schedules.getTotal());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.retrieve()
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ScheduleList{} err := client.Do(result, &operations.ListSchedules{ 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.Schedule.list
特定の顧客に対する定期課金リストを取得
- GET https://api.omise.co/customers/{id}/schedules指定したCustomer IDに紐づく定期課金のリストを返します。
Request Parameters
Name | Type | Description |
---|---|---|
from | string | (任意, default: |
limit | integer | (任意, default: |
offset | integer | (任意, default: |
order | string | (任意, default: |
to | string | (任意) ISO 8601形式 ( |
Example
-
特定の顧客に対する定期課金リストを取得
- curl
- php
- node.js
- ruby
- C#
- python
- go
- elixir
curl https://api.omise.co/customers/cust_test_5g0221fe8iwtayocgja/schedules \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $customer = OmiseCustomer::retrieve('cust_test_58e7b94d2wfmfn6p2x1'); $schedules = $customer->schedules();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.customers.schedules('cust_test_no1t4tnemucod0e51mo'); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" customer = Omise::Customer.retrieve("cust_test_4xtrb759599jsxlhkrb") schedules = customer.schedules
var customerId = "cust_test_59gbtlbjldnc8651pmp"; var schedules = await Client .Customer(customerId) .Schedules .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total schedule for customer: {schedules.Total}");
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" customer = omise.Customer.retrieve("cust_test_no1t4tnemucod0e51mo") schedule = customer.schedule()
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ScheduleList{} err := client.Do(result, &operations.ListCustomerChargeSchedules{ CustomerID: "cust_test_no1t4tnemucod0e51mo", 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.Customer.list_schedules("cust_test_4xtrb759599jsxlhkrb")
特定の受信者のすべての送金スケジュールを一覧表示する
- GET https://api.omise.co/recipients/{id}/schedulesschedule
オブジェクトのlist
を返します。 特定の受信者に属するすべての送金スケジュールを返します。
Request Parameters
Name | Type | Description |
---|---|---|
from | string | (任意, default: |
limit | integer | (任意, default: |
offset | integer | (任意, default: |
order | string | (任意, default: |
to | string | (任意) ISO 8601形式 ( |
Example
-
追加振込先口座のすべての送金スケジュールを一覧表示する。
- curl
- php
- node.js
- C#
- go
- elixir
curl https://api.omise.co/recipients/recp_test_5g03h1x1mbpgxp8h1fhchedules \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $recipient = OmiseRecipient::retrieve('recp_test_546s722se0adnqfenew'); $schedules = $recipient->schedules();
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.recipients.schedules('recp_test_no1t4tnemucod0e51mo'); console.log(schedule);
var recipientId = "recp_test_58fkcajowtvy3pax0ak"; var schedules = await Client .Recipient(recipientId) .Schedules .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"transfer schedule for recipients: {schedules.Total}");
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ScheduleList{} err := client.Do(result, &operations.ListRecipientTransferSchedules{ RecipientID: "recp_test_no1t4tnemucod0e51mo", 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.Recipient.list_schedules("recp_test_4xsj4ndi9w22nod68")
スケジュールを取得
- GET https://api.omise.co/schedules/{id}Schedule IDで指定された特定のスケジュールを返します。
Example
-
スケジュールを取得
- curl
- php
- node.js
- ruby
- C#
- java
- python
- go
- elixir
curl https://api.omise.co/schedules/schd_test_5g022yhk1zcvkf7zbt7 \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $schedule = OmiseSchedule::retrieve('schd_test_58et0oz1hmczg8foppb');
const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const schedule = await omise.schedules.retrieve('schd_test_no1t4tnemucod0e51mo'); console.log(schedule);
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" schedule = Omise::Schedule.retrieve("schd_test_4xsjvylia03ur542vn6")
var scheduleId = "schd_test_58fmj4fpu2zpp2m8s8c"; var schedule = await Client.Schedules.Get(scheduleId); Console.WriteLine($"charges made on schedule: {schedule.Occurrences.Total}");
Request<Schedule> request = new Schedule.GetRequestBuilder("schd_test_57wedy7pc6v9i59xpbx").build(); Schedule schedule = client().sendRequest(request); System.out.printf("Schedule retrieved: %s", schedule.getId());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" schedule = omise.Schedule.retrieve("schd_test_no1t4tnemucod0e51mo")
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Schedule{} err := client.Do(result, &operations.RetrieveSchedule{ScheduleID: "no1t4tnemucod0e51mo"}) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.retrieve("schd_test_4xsjvylia03ur542vn6")