顧客のカード一覧
オプションのソートで特定の顧客に添付されたすべてのカードのページネーション付きリストを取得します。
リクエストパラメータ
必須 - 1 フィールドパスパラメータ
`id`STRING(required)
顧客ID(cust_で始まる有効な顧客IDである必要があります)。
追加 - 3 フィールドページネーションとソート
レスポンス
200
カードが正常に取得されましたカードオブジェクトとページネーション情報を含むリストオブジェクト。
カードオブジェクトに含まれる情報:
id- カードID (card_*)brand- カードブランド(Visa、MasterCard、JCBなど)last_digits- カード番号の下4桁name- カード名義人expiration_month- カード有効期限月(1-12)expiration_year- カード有効期限年(YYYY)bank- 発行銀行名fingerprint- 一意のカード識別子(重複検出用)
400
不正なリクエスト無効なパラメータが提供されました。
一般的な原因:
- 無効なlimit値(100を超過)
- 負のoffset値
- 無効なorder値
401
認証エラー認証に失敗しました。APIキーが無効または不足しています。
一般的な原因:
- Authorizationヘッダーの欠落
- 無効なシークレットキー
- シークレットキーの代わりにパブリックキーを使用
- HTTP Basic Auth形式の誤り
404
見つかりません顧客が見つかりません。
一般的な原因:
- 顧客IDが存在しない
- 顧客が削除済み
5xx
サーバーエラーサーバー側でエラーが発生しました。稀ですが、適切に処理する必要があります。
対処方法:
- 指数バックオフでリクエストを再試行
- status.omise.coでサービスインシデントを確認
- 詳細なガイダンスはエラー処理を参照
コードサンプル
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/customers/cust_test_5xuy4w91xqz7d1w9u0t/cards \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
cards = Omise::Card.list({
customer_id: 'cust_test_5xuy4w91xqz7d1w9u0t'
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
customer = omise.Customer.retrieve('cust_test_5xuy4w91xqz7d1w9u0t')
cards = customer.cards()
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const cards = await omise.customers.listCards('cust_test_5xuy4w91xqz7d1w9u0t', {
limit: 20,
offset: 0
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$customer = OmiseCustomer::retrieve('cust_test_5xuy4w91xqz7d1w9u0t');
$cards = $customer['cards'];
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
ScopedList<Card> cards = client.customer("cust_test_5xuy4w91xqz7d1w9u0t")
.cards()
.list()
.limit(20L)
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var cards = await client.Customers.ListCards("cust_test_5xuy4w91xqz7d1w9u0t", new ListRequest
{
Limit = 20,
Offset = 0
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
cards, _ := client.Cards().ListCards("cust_test_5xuy4w91xqz7d1w9u0t", &operations.ListCards{
List: operations.List{
Limit: 20,
Offset: 0,
},
})
エラーと結果コード
一般的なエラーコード
| コード | 説明 | 解決策 |
|---|---|---|
bad_request | 無効なパラメータ | limitとoffset値を確認 |
authentication_failure | 無効なAPIキー | シークレットキーが正しいか確認 |
not_found | 顧客が見つからない | 顧客IDが存在するか確認 |
カードフィールド
| フィールド | 説明 |
|---|---|
id | カードID (card_*) |
brand | カードブランド(Visa、MasterCardなど) |
last_digits | カード番号の下4桁 |
name | カード名義人 |
expiration_month | 有効期限月(1-12) |
expiration_year | 有効期限年(YYYY) |
bank | 発行銀行名 |
country | カード発行国 |
fingerprint | 重複検出用の一意識別子 |
API認証情報
試してみる
必須 - 1項目
追加 - 3項目
あなたのIP:
...読み込み中...