Occurrence API
Retrieve actual execution dates (occurrences
) for a scheduled charges or transfers. Queryable information includes the retry date, status, or result of a given occurrence.
Attributes
Name | Type | Description |
---|---|---|
object | string | The string |
id | object_id | The occurrence identifier matching |
livemode | boolean | Whether this is a live ( |
location | string | API path to retrieve the current |
created | datetime | UTC datetime of occurrence creation in ISO 8601 format ( |
message | string | Explanation for failure if occurrence processing failed. |
processed_at | datetime | UTC datetime of occurrence processing in ISO 8601 format ( |
result | object_id | Result of occurrence processing. One of charge or transfer (identifier). |
retry_date | date | Retry date if occurrence processing failed. |
schedule | object_id | Schedule to which occurrence belongs. |
schedule_date | date | Date on which occurrence was intended to be processed in ISO 8601 format ( |
status | string | Status of scheduled occurrence. One of |
Retrieve an occurrence
- GET https://api.omise.co/occurrences/{id}Returns the occurrence matching :id
.
Example
-
Retrieve a schedule occurrence
- curl
- php
- ruby
- C#
- python
- go
- elixir
curl https://api.omise.co/occurrences/occu_test_4xso2s8ivdej29pqnhz \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $schedule = OmiseSchedule::retrieve('schd_test_58eszkc69f6xl05ws1s'); $occurrence = $schedule->occurrences()->retrieve('occu_test_58eszkc7yyuj0c8vj8i');
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" schedule = Omise::Schedule.retrieve("schd_test_4xsjvylia03ur542vn6") occurrence = schedule.occurrences.retrieve("occu_test_4xso2s8ivdej29pqnhz") # Or directly through the Occurrence class occurrence = Omise::Occurrence.retrieve("occu_test_4xso2s8ivdej29pqnhz")
var occurrenceId = "occu_test_58965eudn25i1gpip0w"; var occurrence = await Client.Occurrences.Get(occurrenceId); Console.WriteLine($"this occurrence is on: {occurrence.ScheduleDate}");
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" occurrence = omise.Occurrence.retrieve("occu_test_587bugap9mm42nuddig")
client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Occurrence{} err := client.Do(result, &operations.RetrieveOccurrence{"occu_test_no1t4tnemucod0e51mo"}) if err != nil { log.Fatalln(err) } log.Println(result)
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Occurrence.retrieve("occu_test_4xso2s8ivdej29pqnhz")
List occurrences
- GET https://api.omise.co/schedules/{id}/occurrencesReturns a list of occurrences belonging to schedule matching :id
.
Request Parameters
Name | Type | Description |
---|---|---|
from | datetime | (optional, default: |
limit | integer | (optional, default: 20, maximum: 100) Number of records returned. |
offset | integer | (optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning). |
order | string | (optional, default: |
to | datetime | (optional, default: current UTC datetime) Latest UTC datetime for returned records in ISO 8601 format ( |
Example
-
List all occurrences
- curl
- php
- ruby
- C#
- python
- elixir
curl https://api.omise.co/schedules/schd_test_5g022yhk1zcvkf7zbt7/occurrences \ -u $OMISE_SECRET_KEY:
<?php require './omise-php/lib/Omise.php'; define('OMISE_SECRET_KEY', 'skey_test_51fl8dfabe7sqnj8th2'); $schedule = OmiseSchedule::retrieve('schd_test_58eszkc69f6xl05ws1s'); $occurrences = $schedule->occurrences();
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" schedule = Omise::Schedule.retrieve("schd_test_4xsjvylia03ur542vn6") occurrences = schedule.occurrences
var scheduleId = "schd_test_58fiiv0w9m9tl9xnd55"; var occurrences = await Client .Schedule(scheduleId) .Occurrences .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"occurrences so far: {occurrences.Total}");
import omise omise.api_secret = 'skey_test_4xs8breq3htbkj03d2x' occurrence = omise.Occurrence.retrieve()
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Schedule.list_occurrences("schd_test_4xsjvylia03ur542vn6")