領収書の検索
様々な条件で領収書を検索します。このエンドポイントでは、日付範囲、金額、その他の領収書属性などのフィルターを使用して特定の領収書を見つけることができます。
リクエストパラメータ
検索 - 3フィールド検索パラメータ
`query`STRING(optional)
検索クエリ文字列。説明、メタデータ、参照番号を含む領収書フィールドを検索。
`scope`STRING(optional)
領収書内の特定フィールドに検索を限定。
`filters`OBJECT(optional)
検索結果を絞り込むための追加フィルター。金額範囲、通貨、その他の領収書属性を含めることができます。
日付範囲 - 2フィールド日付範囲パラメータ
ページネーション - 3フィールドページネーションパラメータ
レスポンス
200
検索成功検索が正常に完了しました。一致する領収書のページネーションされたリストを返します。
レスポンス構造:
object- 常に "search" を返すdata- 検索条件に一致する領収書オブジェクトの配列limit- ページあたりのレコード数offset- スキップされたレコード数total- 検索に一致する領収書の総数query- 実行された検索クエリ
400
不正なリクエストリクエストの検証に失敗しました。詳細はエラーメッセージを確認してください。
一般的な原因:
- from/toパラメータの無効な日付形式
- 無効なフィルター構文
- 無効なクエリ文字列形式
- limitが最大許容値を超過
401
認証エラー認証に失敗しました。APIキーが無効または欠落しています。
一般的な原因:
- Authorizationヘッダーの欠落
- 無効なシークレットキー
- シークレットキーの代 わりにパブリックキーを使用
- 不正なHTTP Basic Auth形式
404
見つかりません検索エンドポイントまたは要求されたリソースが見つかりません。
一般的な原因:
- 無効なエンドポイントURL
- 不正なAPIバージョン
5xx
サーバーエラーサーバー側でエラーが発生しました。これらは稀ですが、適切に処理する必要があります。
対処方法:
- 指数バックオフでリクエストを再試行
- status.omise.coでサービスインシデントを確認
- 詳細なガイダンスはエラー処理を参照
コードサンプル
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/receipts/receipts/search \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-G \
-d "query=order_12345" \
-d "from=2025-01-01T00:00:00Z" \
-d "limit=20"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
receipts = Omise::Receipt.search(
query: 'order_12345',
from: '2025-01-01T00:00:00Z',
limit: 20
)
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
receipts = omise.Receipt.search(
query='order_12345',
from_date='2025-01-01T00:00:00Z',
limit=20
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const receipts = await omise.receipts.search({
query: 'order_12345',
from: '2025-01-01T00:00:00Z',
limit: 20
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$receipts = OmiseReceipt::search([
'query' => 'order_12345',
'from' => '2025-01-01T00:00:00Z',
'limit' => 20
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
SearchResult<Receipt> receipts = client.receipts().search()
.query("order_12345")
.from("2025-01-01T00:00:00Z")
.limit(20)
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var receipts = await client.Receipts.Search(new SearchOptions
{
Query = "order_12345",
From = DateTime.Parse("2025-01-01T00:00:00Z"),
Limit = 20
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
receipts, _ := client.Receipts().Search(&omise.SearchParams{
Query: "order_12345",
From: "2025-01-01T00:00:00Z",
Limit: 20,
})
エラーと結果コード
一般的なエラーコード
| コード | 説明 | 解決方法 |
|---|---|---|
bad_request | パラメータの欠落または無効 | パラメータの値と形式を確認 |
authentication_failure | 無効なAPIキー | シークレットキーが正しいことを確認 |
invalid_date_format | 日付形式の検証に失敗 | ISO 8601形式(YYYY-MM-DDTHH:MM:SSZ)を使用 |
invalid_query | 検索クエリ形式が無効 | クエリ文字列の構文を確認 |
領収書オブジェクトフィール ド
| フィールド | 型 | 説明 |
|---|---|---|
object | string | 常に "receipt" を返す |
id | string | 領収書識別子(rcpt_*) |
livemode | boolean | 本番環境かテスト環境かのインジケーター |
location | string | 領収書オブジェクトへのAPIパス |
adjustment_transaction | string | 関連する調整トランザクションID |
charge_fee | integer | 最小通貨単位でのOmise課金手数料 |
company_address | string | Omise会社住所 |
company_name | string | Omise会社名 |
company_tax_id | string | Omise会社税番号 |
credit_note | boolean | これがクレジットノートかどうか |
currency | string | 3文字のISO 4217コード |
customer_address | string | マーチャント住所 |
customer_email | string | マーチャントメール |
customer_name | string | マーチャント名 |
customer_statement_name | string | マーチャント明細名 |
customer_tax_id | string | マーチャント税番号 |
issued_on | string | 領収書発行日 |
number | string | 領収書番号 |
subtotal | integer | 税抜き小計 |
total | integer | 合計(subtotal + vat - whtとして計算) |
transaction_fee | integer | 最小通貨単位でのトランザクション手数料 |
transfer_fee | integer | 最小通貨単位での振込手数料 |
vat | integer | VAT金額 |
voided_fee | integer | 無効化手数料金額 |
wht | integer | 源泉徴収税金額 |
created_at | string | ISO 8601形式のUTC日時 |
API認証情報
試してみる
追加 - 5項目
あなたのIP:
...読み込み中...