最初に結論 / 質問履歴9

「決済」及び「開発」関連用語集

カテゴリー: Stripe  閲覧数:290 配信日:2019-02-22 12:17


最初に結論


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',
))


週間人気ページランキング / 3-22 → 3-28
順位 ページタイトル抜粋 アクセス数
1 YouTube | 動画サービス(課金販売できるプラットフォーム) 7
2 その他エントリー(Stripe) カテゴリー 4
2 EMVレベル1 / EMVレベル2 / EMVCo とは? 4
2 Off-session Payments with Payment Intents / Payment Intents を使用したオフセッション支払 4
3 支払い 3
3 クレジットカード決済 | 課金 3
3 QA(Stripe) カテゴリー 3
3 Stripe Q15。PaymentIntent でエラー。カード番号に不備があります。 | QA(Stripe) 3
4 EMVCo | クレジットカード仕様(仕様) 2
4 Stripe Q16。PaymentIntentの支払いで郵便番号入力を求められる。Radar rules の ZIP code を無効にしているのに | QA(Stripe) 2
4 Stripe エラー(Stripe) カテゴリー 2
4 資金決済に関する法律(資金決済法)とは?/(1)前払式支払手段 /(2)資金移動業 2
4 プリペイドカード | カード 2
4 Stripe Q60. Checkout\SessionオブジェクトとPaymentIntentオブジェクトの関係性は1対1ですか? | QA(Stripe) 2
4 QRコード決済 | 課金 2
4 Stripe Q48。「Checkout\Session - server」「Charge」「PaymentIntent」の使い分け方 | QA(Stripe) 2
4 振込 | 送金 2
5 Stripe Q11。テストAPIで、実際のカード番号を入力したらどうなりますか? | QA(Stripe) 1
5 Vプリカとは?/ 特徴 1
5 ICクレジットカード | クレジットカード仕様(仕様) 1
2024/3/29 1:01 更新
指定期間人気ページランキング / 2020-5-28 → 2024-3-28
順位 ページタイトル抜粋 アクセス数
1 Stripeアカウントへログインする際、モバイル端末で受信したコード入力を求められる理由は? | その他エントリー(Stripe) 2006
2 EMVCo | クレジットカード仕様(仕様) 1252
3 Stripe Q13。決済成功時に、「請求に紐づけられたメールアドレス」に対して、メール送信したいのですが、 | QA(Stripe) 938
4 Stripe Q16。PaymentIntentの支払いで郵便番号入力を求められる。Radar rules の ZIP code を無効にしているのに | QA(Stripe) 898
5 Twitch | ゲーム実況配信サービス(課金販売できるプラットフォーム) 876
6 クレジットカード決済 | 課金 875
7 決済用語 853
8 Stripe Q50。 Connect 「Standardアカウント」で、自身に連結された子アカウントを、ダッシュボードから削除するには? | QA(Stripe) 822
9 Omise | 「支払」機能を有する決済系サービス(決済サービス) 762
10 Stripe Q1。Stripeにおける個人事業主の定義 | QA(Stripe) 755
11 Stripe Q31。ダッシュボードでの「支払い作成」の見方について | QA(Stripe) 736
12 pixivFANBOX | クリエイター支援プラットフォーム(課金販売できるプラットフォーム) 733
13 EMVレベル1 / EMVレベル2 / EMVCo とは? 710
14 YouTube | 動画サービス(課金販売できるプラットフォーム) 646
15 プリペイドカード | カード 636
16 EPUB | ファイルフォーマット(電子書籍) 585
17 サブスクリプション | 課金 563
18 Stripeで"No such token: src"と表示されたら、最初にAPIキーを確認する | Stripe エラー(Stripe) 542
19 Stripe Q74.「お客様のビジネスの詳細」とは何ですか? | Stripe 536
20 ファンティア | クリエイター支援プラットフォーム(課金販売できるプラットフォーム) 482
2024/3/29 1:01 更新