Stripe Q9。Checkout beta version で、webhookを受け取ると、client_reference_idがNULL

StripeQA

目次一覧

 状態:-  閲覧数:926  投稿日:2019-02-22  更新日:2019-03-21  
最初に結論 / 質問履歴9

最初に結論 / 質問履歴9

 閲覧数:291 投稿日:2019-02-22 更新日:2019-02-26 

最初に結論


Checkout beta version
・webhookで'client_reference_id'を受け取るためには、予め 'clientReferenceId'を指定しておく必要がある

クライアント側
<!-- Load Stripe.js on your website. -->
<script src="https://js.stripe.com/v3"></script>

<!-- Create a button that your customers click to complete their purchase. -->
<button id="checkout-button" role="link">Pay</button>
<div id="error-message"></div>

<script>
 var stripe = Stripe('pk_test_〇〇', {
   betas: ['checkout_beta_4']
 });

 var checkoutButton = document.getElementById('checkout-button');
 checkoutButton.addEventListener('click', function () {
   // When the customer clicks on the button, redirect
   // them to Checkout.
   stripe.redirectToCheckout({
     items: [{sku: 'sku_EYUuveVPe61SrH', quantity: 1}],
     // Note that it is not guaranteed your customers will be redirected to this
     // URL *100%* of the time, it's possible that they could e.g. close the
     // tab between form submission and the redirect.
     successUrl: 'https://省略',
     cancelUrl: 'https://省略',
     clientReferenceId: 'order_123',
   })
   .then(function (result) {
     if (result.error) {
       // If `redirectToCheckout` fails due to a browser or network
       // error, display the localized error message to your customer.
       var displayError = document.getElementById('error-message');
       displayError.textContent = result.error.message;
     }
   });
 });
</script>


PHPで受け取った結果
stdClass::__set_state(array(
'id' => 'evt_1E7vFPJiXAQvfxv3mC6pUpZE',
'object' => 'event',
'api_version' => '2019-02-19',
'created' => 1551146443,
'data' =>
stdClass::__set_state(array(
'object' =>
stdClass::__set_state(array(
'object' => 'checkout_beta',
'client_reference_id' => 'order_123',
'display_items' =>
array (
0 =>
stdClass::__set_state(array(
'currency' => 'jpy',
'amount' => 10000,
'type' => 'sku',
'quantity' => 1,
'sku' => 'sku_EYUuveVPe61SrH',
)),
),
'line_items' => NULL,
'livemode' => false,
'payment_intent' => 'pi_1E7vF1JiXAQvfxv3XC5ezNTm',
)),
)),
'livemode' => false,
'pending_webhooks' => 1,
'request' =>
stdClass::__set_state(array(
'id' => NULL,
'idempotency_key' => NULL,
)),
'type' => 'checkout_beta.session_succeeded',
))


質問履歴9


Checkout beta version で、webhookを受け取ると、client_reference_idがNULL
・2019/2/22
Checkout beta version で、webhookを受け取ると、client_reference_idがNULLになるのですが、redirectToCheckoutを指定した場合は、ここで「一意の文字列」を受け取れるわけではないのでしょうか?
・redirectToCheckoutの書き方がおかしいですか?


クライアント
<script>
 var stripe = Stripe('pk_test_〇〇', {
   betas: ['checkout_beta_4']
 });
 var checkoutButton = document.getElementById('checkout-button');
 checkoutButton.addEventListener('click', function () {
   stripe.redirectToCheckout({
     items: [{sku: 'sku_EYUuveVPe61SrH', quantity: 1}],
     successUrl: '省略',
     cancelUrl: '省略',
   })
   .then(function (result) {
     if (result.error) {
       var displayError = document.getElementById('error-message');
       displayError.textContent = result.error.message;
     }
   });
 });
</script>

PHPで受け取った結果
stdClass::__set_state(array(
  'id' => 'evt_1E6I74JiXAQvfxv3iGbGoRcu',
  'object' => 'event',
  'api_version' => '2019-02-19',
  'created' => 1550757682,
  'data' =>
 stdClass::__set_state(array(
    'object' =>
   stdClass::__set_state(array(
      'object' => 'checkout_beta',
      'client_reference_id' => NULL,
      'display_items' =>
     array (
       0 =>
       stdClass::__set_state(array(
          'currency' => 'jpy',
          'amount' => 10000,
          'type' => 'sku',
          'quantity' => 1,
          'sku' => 'sku_EYUuveVPe61SrH',
       )),
     ),
      'line_items' => NULL,
      'livemode' => false,
      'payment_intent' => 'pi_1E6I6eJiXAQvfxv3IMxgerR9',
   )),
 )),
  'livemode' => false,
  'pending_webhooks' => 1,
  'request' =>
 stdClass::__set_state(array(
    'id' => NULL,
    'idempotency_key' => NULL,
 )),
  'type' => 'checkout_beta.session_succeeded',
))



Stripe Q8。Stripe Checkout public beta version について

Stripe Q10。Checkout の Simple で、「data-zip-code="true"」追加した場合について

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



類似度ページランキング
順位 ページタイトル抜粋
1 Stripe Q9。Checkout beta version で、webhookを受け取ると、client_reference_idがNULL 53
2 Stripe Q8。Stripe Checkout public beta version について 34
3 Stripeで"No such token: src"と表示されたら、最初にAPIキーを確認する 33
4 Stripe Q29。日本で、Connect Customアカウント を導入している事例について 33
5 Stripe Q62.Webhook::constructEventで、SignatureVerificationエラーになるのですが… 33
6 Stripe Q20。「webhook」と「synchronous」と「Checkout beta version」について 33
7 Stripe Q73.CheckoutのSessionオブジェクトをcreateする際、'payment_intent_data'内の'metadata'として渡したデータを、webhookで受け取る件について 33
8 Stripe Q21。新規顧客作成時に新規ソースオブジェクトを添付したいのですが、No such token: src_xxxxとなります 33
9 Stripe Q71.CheckoutSessionで、success_urlに指定したURLでzipダウンロードすると、success_urlへ遷移しない 32
10 Stripe Q51.Connect Standard アカウント連結後の返り値で、"refresh_token”も保存した方が良いですか? 31
11 Stripe Q52.Checkout\Sessionで1回限りの決済終了した際、添付メール自動送信することはできますか? 30
12 Stripe Q10。Checkout の Simple で、「data-zip-code="true"」追加した場合について 30
13 Stripe Q56. 作成したCheckout\Sessionオブジェクトが破棄されるタイミングは? 29
14 Stripe Q46。Direct Charges で手数料聴取する場合、'payment_intent_data'の「有り」「無し」の違いは? 29
15 Stripe Q53.Checkout\Sessionの1回限りの支払いで、決済完了したユーザにだけページ表示させたい 29
16 Stripe Q48。「Checkout\Session - server」「Charge」「PaymentIntent」の使い分け方 29
17 Stripe Q68.WebhookはPUT送信しているのですか? 29
18 Stripe Payments > COLLECTING PAYMENT DETAILS > Checkout 28
19 Purchase Fulfillment 28
20 Stripe Q17。カード情報を「card object」「source object」へ保存する違いについて 28
2024/4/26 19:43 更新
週間人気ページランキング / 4-19 → 4-25
順位 ページタイトル抜粋 アクセス数
1 YouTube | 動画サービス(課金販売できるプラットフォーム) 7
2 EMVCo | クレジットカード仕様(仕様) 6
3 EMVレベル1 / EMVレベル2 / EMVCo とは? 5
4 クレジットカード決済 | 課金 4
5 pixivFANBOX | クリエイター支援プラットフォーム(課金販売できるプラットフォーム) 3
5 Squareは、デジタルコンテンツ(デジタル情報)の配信利用が認められないサービス | 「支払」機能を有する決済系サービス(決済サービス) 3
6 Stripeアカウントへログインする際、モバイル端末で受信したコード入力を求められる理由は? | その他エントリー(Stripe) 2
6 Off-session Payments with Payment Intents / Payment Intents を使用したオフセッション支払 2
6 Stripe Q32。Webhook のエンドポイントから適切な値を返さなかったときの停止措置について | QA(Stripe) 2
6 「支払」と「送金」の違い | 違い 2
6 Stripe Q16。PaymentIntentの支払いで郵便番号入力を求められる。Radar rules の ZIP code を無効にしているのに | QA(Stripe) 2
6 プリペイドカード | カード 2
7 振込 | 送金 1
7 IBAN | 海外送金(送金) 1
7 Stripe Q11。テストAPIで、実際のカード番号を入力したらどうなりますか? | QA(Stripe) 1
7 Stripe Q53.Checkout\Sessionの1回限りの支払いで、決済完了したユーザにだけページ表示させたい | QA(Stripe) 1
7 ツイキャスとは?/ 特徴 / キートスとは? 1
7 note | 課金販売できるプラットフォーム 1
7 Stripe webhook 配信の問題 / 実際に受け取った警告メールの受信例 1
7 Stripe webhook 配信の問題 | その他エントリー(Stripe) 1
2024/4/26 1:02 更新