返金の取得
ステータス、金額、関連トランザクションを含む特定の返金に関する詳細情報を取得します。
リクエストパラメータ
必須 - 2項目必須パラメータ
`charge_id`STRING(required)
返金された課金ID(パスパラメータ)。
`refund_id`STRING(required)
取得する返金ID(パスパラメータ)。形式: rfnd_test_ または rfnd_live_ の後に英数字の文字列。
レスポンス
200
取得成功ステータス、金額、タイムスタンプを含む返金オブジェクトのすべての詳細を返します。
レスポンスの内容:
object- 値は "refund"id- 返金識別子(rfnd_*)livemode- 本番モードまたはテストモードlocation- 返金オブジェクトへのAPIパスacquirer_reference_number- カードネットワークに送信された参照番号amount- 最小通貨単位での返金額approval_code- 承認済み取引の参照番号capture- キャプチャ参照charge- 関連する課金ID(展開可能)currency- ISO 4217の3文字通貨コードfunding_amount- 決済通貨での金額funding_currency- 決済通貨コードmerchant_name- サブマーチャント名(Payfacのみ)merchant_uid- サブマーチャントID(Payfacのみ)metadata- 返金に添付されたカスタムメタデータstatus- 現在の返金ステータス(pending、successful、failed)terminal- 元の販売時点情報transaction- 関連するトランザクションID(展開可能)voided- 返金がボイドとして処理されたかどうか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/charges/chrg_test_5xuy4w91xqz7d1w9u0t/refunds/rfnd_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
refund = Omise::Refund.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t', {
charge: 'chrg_test_5xuy4w91xqz7d1w9u0t'
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
refund = omise.Refund.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t',
charge='chrg_test_5xuy4w91xqz7d1w9u0t'
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const refund = await omise.refunds.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t', 'rfnd_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$refund = OmiseRefund::retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t', [
'charge' => 'chrg_test_5xuy4w91xqz7d1w9u0t'
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Refund refund = client.refunds().get("chrg_test_5xuy4w91xqz7d1w9u0t", "rfnd_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var refund = await client.Refunds.Get("chrg_test_5xuy4w91xqz7d1w9u0t", "rfnd_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
refund, _ := client.GetRefund("chrg_test_5xuy4w91xqz7d1w9u0t", "rfnd_test_5xuy4w91xqz7d1w9u0t")
エラーコードと結果コード
一般的なエラーコード
| コード | 説明 | 解決方法 |
|---|---|---|
authentication_failure | 無効なAPIキー | シークレットキーが正しいか確認 |
not_found | 返金または課金が見つからない | IDが正しいか確認 |
invalid_refund_id | 返金IDの形式が無効 | 有効なrfnd_形式を使用 |
返金ステータスコード
| ステータス | 説明 |
|---|---|
pending | 返金処理中 |
successful | 返金が正常に完了 |
failed | 返金に失敗(まれ) |
API認証情報