チャージの返金を取得
チャージの特定の返金を取得します。ステータス、金額、トランザクション詳細を含む返金の完全な情報を返します。
リクエストパラメータ
必須 - 2項目必須パラメータ
`id`STRING(required)
返金が属するチャージID。アカウントの有効なチャージIDである必要があります。
`refund_id`STRING(required)
取得する返金ID。指定されたチャージに関連付けられた有効な返金IDである必要があります。
レスポンス
200
取得成功すべてのフィールドを含む完全な返金オブジェクトを返します。
レスポンス内容:
id- 返金IDstatus- pending、closed、またはfailedamount- 最小通貨単位での返金額currency- 通貨コードcharge- 関連するチャージIDtransaction- 関連するトランザクションIDcreated_at- 返金作成タイムスタンプmetadata- カスタムメタデータ(設定されている場合)
400
不正なリクエスト無効なパラメータが指定されました。
一般的な原因:
- 無効なチャージID形式
- 無効な返金ID形式
401
認証エラー認証に失敗しました。無効または欠落したAPIキー。
一般的な原因:
- Authorizationヘッダーの欠落
- 無効なシークレットキー
- シークレットキーの代わりにパブリックキーを使用
404
見つかりませんチャージIDまたは返金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'
charge = Omise::Charge.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t')
refund = charge.refunds.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = omise.Charge.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t')
refund = charge.refunds.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const refund = await omise.charges.retrieveRefund(
'chrg_test_5xuy4w91xqz7d1w9u0t',
'rfnd_test_5xuy4w91xqz7d1w9u0t'
);
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$charge = OmiseCharge::retrieve('chrg_test_5xuy4w91xqz7d1w9u0t');
$refund = $charge->refunds()->retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Refund refund = client.charges()
.get("chrg_test_5xuy4w91xqz7d1w9u0t")
.refunds()
.get("rfnd_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var refund = await client.Charges.GetRefund(
"chrg_test_5xuy4w91xqz7d1w9u0t",
"rfnd_test_5xuy4w91xqz7d1w9u0t"
);
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
refund, _ := client.RetrieveChargeRefund(
"chrg_test_5xuy4w91xqz7d1w9u0t",
"rfnd_test_5xuy4w91xqz7d1w9u0t",
nil,
)
エラーと結果コード
返金ステータス値
| ステータス | 説明 | 次のステップ |
|---|---|---|
pending | 返金処理中 | 完了を待つ |
closed | 返金が正常に完了 | 資金が顧客 に返還済み |
failed | 返金失敗 | 失敗理由を確認 |
返金オブジェクトフィールド
| フィールド | タイプ | 説明 |
|---|---|---|
id | string | 一意の返金識別子 |
object | string | 常に"refund" |
livemode | boolean | 本番モードの返金かどうか |
location | string | この返金へのAPIパス |
amount | integer | 最小通貨単位での返金額 |
currency | string | 3文字のISO通貨コード |
charge | string | 返金されたチャージのID |
transaction | string | 関連するトランザクションのID |
status | string | 現在の返金ステータス |
created_at | string | 作成のISO 8601タイムスタンプ |
metadata | object | カスタムキー・バリューペア |
API認証情報
試してみる
必須 - 2項目
あなたのIP:
...読み込み中...