返金の検索
メタデータ、金額、ステータスなどでトランザクションを検索し、返金をフィルタリングします。Search APIはすべての返金に対して強力な全文検索機能を提供します。
リクエストパラメータ
必須 - 1項目必須パラメータ
`scope`STRING(required)
検索スコープ。返金を検索するには "refund" に設定する必要があります。
推奨 - 2項目推奨パラメータ
`query`STRING(optional)
検索クエリ文字列。返金メタデータ、課金情報、トランザクション詳細を横断して検索します。複数の単語(AND論理)と部分一致をサポートします。
`filters`OBJECT(optional)
検索結果を絞り込むフィルタ条件。一般的なフィルタにはstatus、currency、amount、voided、作成日範囲があります。
追加 - 3項目追加パラメータ
レスポンス
200
検索成功検索が正常に完 了しました。data配列に一致する返金を含む検索結果オブジェクトを返します。
レスポンスの内容:
data- 検索条件に一致する返金オブジェクトの配列total- 検索に一致する結果の総数total_pages- 利用可能なページ数page- 現在のページ番号per_page- 1ページあたりの結果数order- 適用されたソート順(chronologicalまたはreverse_chronological)
400
不正なリクエストリクエストの検証に失敗しました。詳細はエラーメッセージを確認してください。
よくある原因:
- 必須の
scopeパラメータがない - 無効なページ番号(1未満)
- 無効なper_page値(100を超えるか1未満)
- 不正な形式のfiltersオブジェクト
401
認証エラー認証に失敗しました。APIキーが無効または不足しています。
よくある原因:
- Authorizationヘッダーがない
- シークレットキーが無効
- シークレットキーの代わりにパブリックキーを使用
- HTTP Basic Auth形式が不正
404
見つかりませんリクエストされたリソースが見つかりませんでした。
よくある原因:
- 無効なAPIエンドポイントURL
- 不正なURLパス
422
無効なスコープ無効な検索スコープが指定されました。
よくある原因:
- scopeパラメータが "refund" ではない
- 無効なscope値
5xx
サーバーエラーサーバー側のエラーが発生しました。これらはまれですが、適切に処理する必要があります。
対処方法:
- 指数バックオフでリクエストを再試行
- status.omise.coでサービス障害を確認
- 詳細なガイダンスはエラー処理を参照
コードサンプル
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/search \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "scope=refund" \
-d "query=order refund" \
-d "filters[status]=successful" \
-d "filters[currency]=thb"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
results = Omise::Search.execute({
scope: 'refund',
query: 'order refund',
filters: {
status: 'successful',
currency: 'thb'
}
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
results = omise.Search.execute(
scope='refund',
query='order refund',
filters={
'status': 'successful',
'currency': 'thb'
}
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const results = await omise.search.execute({
scope: 'refund',
query: 'order refund',
filters: {
status: 'successful',
currency: 'thb'
}
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$results = OmiseSearch::execute([
'scope' => 'refund',
'query' => 'order refund',
'filters' => [
'status' => 'successful',
'currency' => 'thb'
]
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Map<String, Object> filters = new HashMap<>();
filters.put("status", "successful");
filters.put("currency", "thb");
SearchResult<Refund> results = client.search()
.scope("refund")
.query("order refund")
.filters(filters)
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var results = await client.Search.Execute(new SearchRequest
{
Scope = "refund",
Query = "order refund",
Filters = new Dictionary<string, object>
{
{ "status", "successful" },
{ "currency", "thb" }
}
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
results, _ := client.Search(&operations.SearchRefunds{
Scope: "refund",
Query: "order refund",
Filters: map[string]interface{}{
"status": "successful",
"currency": "thb",
},
})
エラーコードと結果コード
一般的なエラーコード
| コード | 説明 | 解決方法 |
|---|---|---|
bad_request | パラメータが不足または無効 | scopeが指定されており、パラメータが有効か確認 |
authentication_failure | 無効なAPIキー | シークレットキーが正しいか確認 |
invalid_scope | 無効な検索スコープ | scopeが "refund" に設定されているか確認 |
検索フィルタオプション
| フィルタ | 型 | 説明 |
|---|---|---|
status | string | 返金ステータス(pending、successful、failed) |
currency | string | 通貨コード(thb、jpy、sgd、myr、usdなど) |
amount | integer | 最小通貨単位での正確な金額 |
voided | boolean | 返金がボイドとして処理されたかどうか(true/false) |
created | object | 日付範囲フィルタ(例: {gte: '2025-01-01', lte: '2025-01-31'}) |
返金ステータスコード
| ステータス | 説明 |
|---|---|
pending | 返金処理中 |
successful | 返金が正常に完了 |
failed | 返金に失敗(まれ) |
API認証情報
試してみる
必須 - 1項目
推奨 - 2項目
追加 - 3項目
あなたのIP:
...読み込み中...