Stripe Q25。Why is it an error to use “token_xxxx” not associated with a Customer object for payment?

StripeQA

目次一覧

 状態:-  閲覧数:579  投稿日:2019-03-18  更新日:2019-03-21  
質問履歴25 / A

最初に結論 / 質問履歴25 / A

 閲覧数:352 投稿日:2019-03-18 更新日:2019-03-19 

最初に結論


Chargeオブジェクトをcreateする際
・下記パラメータの組み合わせは不可
'customer' => 'cus_xxxx',
'source' => 'tok_xxxx',

Chargeオブジェクトをcreateする際、可能なパラメータ組み合わせ例は2
・パラメータ組み合わせ例1
・この場合'source'パラメータは、Customerオブジェクトの'default_source'プロパティ値となる
'customer' => 'cus_xxxx',

・パラメータ組み合わせ例2
'customer' => 'cus_xxxx',
'source' => 'src_xxxx',


質問履歴25


Why is it an error to use “token_xxxx” not associated with a Customer object for payment?
・2019/3/18

In the following PHP code, token_xxxx is associated with the Customer object
\Stripe\Stripe::setApiKey("sk_test_xxxx");
\Stripe\Customer::create([
 "description" => "hoge",
 "source" => "tok_amex"
]);


In the PHP code below, "token_xxxx" not associated with the Customer object is used for payment
\Stripe\Stripe::setApiKey('sk_test_xxxx');
$charge = \Stripe\Charge::create([
 "amount" => 888,
 "currency" => "USD",
 "customer" => "cus_xxxx",
 'source' => 'tok_visa',
]);


・An error occurred
Customer cus_xxxx does not have a linked source with ID tok_xxxx

Customerオブジェクトに関連付けていない「token_xxxx」を、支払いに使用するとエラーになるのはなぜですか?
下記コードでは、token_xxxxをCustomerオブジェクトに関連付けている
\Stripe\Stripe::setApiKey("sk_test_xxxx");
\Stripe\Customer::create([
 "description" => "hoge",
 "source" => "tok_amex"
]);


下記コードでは、Customerオブジェクトに関連付けていない「token_xxxx」を、支払いに使用している
\Stripe\Stripe::setApiKey('sk_test_xxxx');
$charge = \Stripe\Charge::create([
 "amount" => 888,
 "currency" => "USD",
 "customer" => "cus_xxxx",
 'source' => 'tok_visa',
]);


・エラーが発生した
Customer cus_xxxx does not have a linked source with ID tok_xxxx


Why is it an error to use "token_xxxx" not associated with a Customer object for payment?

A


Stripe APIでは
・sourceは基本的に、保存された支払い方法(クレジットカードなど)である

「customer」パラメータでchargeを作成する場合
・2つのオプションがある

1)sourceパラメータなしで作成する
・この場合、顧客のデフォルトのソース(デフォルトの保存カード)が使用される

2)"source"パラメータを使って作成する
・この場合、提供されたsourceが顧客に保存されたカードであることを確認する必要がある

tok_visaは、どの顧客にも保存されていない単なるストライプテストトークンなので、 "Customer"と一緒に使用することはできない
・そのため、エラーが発生する


Stripe Q24。After attaching the source to the customer object, how do I check from the customer object?

Stripe Q26。If you only accept credit card payments, are there any functions that can not be done with src_xxxx but only with tok_xxxx?

コメント投稿(ログインが必要)



類似度ページランキング
順位 ページタイトル抜粋
1 Stripe Q25。Why is it an error to use “token_xxxx” not associated with a Customer object for payment? 33
2 Stripe Q20。「webhook」と「synchronous」と「Checkout beta version」について 27
3 Stripe Q9。Checkout beta version で、webhookを受け取ると、client_reference_idがNULL 27
4 Stripe Q8。Stripe Checkout public beta version について 25
5 Stripe Q38。Difference between “paymentIntent.status === 'succeeded'” and “payment_intent.succeeded event of Webhook” 25
6 Stripe Q24。After attaching the source to the customer object, how do I check from the customer object? 25
7 Stripe Q51.Connect Standard アカウント連結後の返り値で、"refresh_token”も保存した方が良いですか? 25
8 Stripe Q48。「Checkout\Session - server」「Charge」「PaymentIntent」の使い分け方 24
9 Stripe Q62.Webhook::constructEventで、SignatureVerificationエラーになるのですが… 24
10 Stripe Q30。Checkout (new) の「Checkout Server Quickstart」の「Step 2: Add Checkout to your website」について 23
11 Stripe Payments > COLLECTING PAYMENT DETAILS > Checkout 23
12 Stripe Q26。If you only accept credit card payments, are there any functions that can not be done with src_xxxx but only with tok_xxxx? 23
13 Stripe Payments > Quickstart / クイックスタート 23
14 Stripe Q29。日本で、Connect Customアカウント を導入している事例について 23
15 Stripe Q60. Checkout\SessionオブジェクトとPaymentIntentオブジェクトの関係性は1対1ですか? 23
16 Stripe Q56. 作成したCheckout\Sessionオブジェクトが破棄されるタイミングは? 23
17 Stripe Q21。新規顧客作成時に新規ソースオブジェクトを添付したいのですが、No such token: src_xxxxとなります 22
18 Stripe Q73.CheckoutのSessionオブジェクトをcreateする際、'payment_intent_data'内の'metadata'として渡したデータを、webhookで受け取る件について 22
19 Stripe Q52.Checkout\Sessionで1回限りの決済終了した際、添付メール自動送信することはできますか? 22
20 Stripe Q46。Direct Charges で手数料聴取する場合、'payment_intent_data'の「有り」「無し」の違いは? 22
2024/7/27 17:29 更新
週間人気ページランキング / 7-20 → 7-26
順位 ページタイトル抜粋 アクセス数
1 決済系サービス比較 | 決済(Webサービスビジネス) 3
1 Twitch | ゲーム実況配信サービス(課金販売できるプラットフォーム) 3
2 支払い 2
2 Stripe Q47。Charge::create の 'receipt_email' について | QA(Stripe) 2
2 Stripe webhook 配信の問題 / 実際に受け取った警告メールの受信例 2
2 Stripe Q37。PaymentIntentで支払いを行った後、成功画面を表示させるためにはどうすれば良いですか? | QA(Stripe) 2
3 普通送金とは? / 処理の流れ 1
3 ファンティア | クリエイター支援プラットフォーム(課金販売できるプラットフォーム) 1
3 Stripe Payments > SOURCES / ソース | documentation(Stripe) 1
3 Stripe Q16。PaymentIntentの支払いで郵便番号入力を求められる。Radar rules の ZIP code を無効にしているのに | QA(Stripe) 1
3 PaymentIntentで支払を実装する場合の選択肢 /「Payment Intents API」使用によるカードの支払確認方法は2種類 / PaymentMethodオブジェクトは歴史的経緯により3種類ある 1
3 決済用語 1
3 Stripe Q43。payouts スケジュールについて | QA(Stripe) 1
3 「払い戻し」と「チャージバック」の違い | 違い 1
3 EMVレベル1 / EMVレベル2 / EMVCo とは? 1
3 Stripe Q74.「お客様のビジネスの詳細」とは何ですか? | Stripe 1
3 Stripe Q21。新規顧客作成時に新規ソースオブジェクトを添付したいのですが、No such token: src_xxxxとなります | QA(Stripe) 1
3 Stripe オブジェクト | その他エントリー(Stripe) 1
3 LINE LIVE | ライブ配信サービス(課金販売できるプラットフォーム) 1
3 日本で、Connect Standardアカウント を導入している(と思われる)事例 | その他エントリー(Stripe) 1
2024/7/27 1:02 更新