領収書の取得
識別子で特定の領収書の詳細を取得します。手数料内訳を含む完全な領収書オブジェクトを返します。
リクエストパラメータ
必須 - 1フィールド必須パラメータ
`receipt_id`STRING(required)
パターン /rcpt(_test)?_[0-9a-z]+/ に一致する領収書識別子。URL パスで指定します。
レスポンス
200
取得成功領収書が正常に取得されました。すべての詳細を含む完全な領収書オブジェクトを返します。
レスポンスに含まれる項目:
object- 値 "receipt"id- 領収書識別子(rcpt_*)livemode- 本番またはテストモードlocation- 領収書オブジェクトへのAPIパスadjustment_transaction- 関連する調整トランザクションIDcharge_fee- 最小通貨単位での累積課金手数料company_address- Omise会社住所company_name- Omise会社名company_tax_id- Omise会社税番号credit_note- これがクレジットノートかどうかcurrency- 3文字のISO 4217通貨コードcustomer_address- マーチャント住所customer_email- マーチャントメールcustomer_name- マーチャント名customer_statement_name- マーチャ ント明細名customer_tax_id- マーチャント税番号issued_on- 領収書発行日number- 領収書番号subtotal- 最小通貨単位での税抜き小計total- 合計金額(subtotal + vat - wht)transaction_fee- 最小通貨単位でのトランザクション手数料transfer_fee- 最小通貨単位での振込手数料vat- 最小通貨単位でのVAT金額voided_fee- 最小通貨単位での無効化手数料金額wht- 最小通貨単位での源泉徴収税金額created_at- 領収書作成タイムスタンプ(ISO 8601)
401
認証エラー認証に失敗しました。APIキーが無効または欠落しています。
一般的な原因:
- Authorizationヘッダーの欠落
- 無効なシークレットキー
- シークレットキーの代わりにパブリックキーを使用
- 不正なHTTP Basic Auth形式
404
見つかりません指定されたIDの領収書が見つかりません。
一般的な原因:
- 無効な領収書ID形式
- 領収書が存在しない
- 領収書が別のアカウントに属している
- 本番領収書IDでテストキーを使用(またはその逆)
5xx
サーバーエラーサーバー側でエラーが発生しました。これらは稀ですが、適切に処理する必要があります。
対処方法:
- 指数バックオフでリクエストを再試行
- status.omise.coでサービスインシデントを確認
- 詳細なガイダンスはエラー処理を参照
コードサンプル
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/receipts/rcpt_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
receipt = Omise::Receipt.retrieve('rcpt_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
receipt = omise.Receipt.retrieve('rcpt_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const receipt = await omise.receipts.retrieve('rcpt_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$receipt = OmiseReceipt::retrieve('rcpt_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Receipt receipt = client.receipts().get("rcpt_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var receipt = await client.Receipts.Get("rcpt_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
receipt, _ := client.Receipts().Get("rcpt_test_5xuy4w91xqz7d1w9u0t")
エラーと結果コード
一般的なエラーコード
| コード | 説明 | 解決方法 |
|---|---|---|
authentication_failure | 無効なAPIキー | シークレットキーが正しいことを確認 |
not_found | 領収書が見つかりません | 領収書IDが正しく存在することを確認 |
invalid_receipt_id | 不正な領収書ID | IDがフォーマット rcpt(test)?[0-9a-z]+ に一致することを確認 |
領収書オブジェクトフィールド
| フィールド | 型 | 説明 |
|---|---|---|
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) |
API認証情報
試してみる
必須 - 1項目
あなたのIP:
...読み込み中...