コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
Revenue
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
Stripe Payments について
構築済みのシステムをアップグレード
支払いの分析
オンライン決済
概要ユースケースを見つけるManaged Payments
Payment Links を使用する
決済ページを構築
    概要
    クイックスタート
    デザインをカスタマイズする
    追加情報を収集する
      実際の住所を収集
      配送料金を請求
      電話番号を収集
      カスタムフィールドを追加
      プロモーションメールへの同意を収集する
    税金を徴収する
    決済フローを動的に更新
    商品カタログを管理する
    サブスクリプション
    決済手段を管理
    顧客が現地通貨で支払いできるようにする
    割引、アップセル、オプション品目を追加する
    将来の支払いを設定する
    支払い中に支払い詳細を保存する
    サーバーで支払いを手動で承認する
    支払い後
    Elements with Checkout Sessions API ベータ版の変更ログ
    従来の Checkout からの移行
    Checkout を移行して Prices を使用
高度なシステムを構築
アプリ内実装を構築
決済手段
決済手段を追加
決済手段を管理
Link による購入の迅速化
支払いインターフェイス
Payment Links
Checkout
Web Elements
アプリ内 Elements
決済シナリオ
カスタムの決済フロー
柔軟なアクワイアリング
オーケストレーション
店頭支払い
端末
他の Stripe プロダクト
Financial Connections
仮想通貨
Climate
ホーム支払いBuild a checkout pageCollect additional information

カスタムフィールドを追加する

Checkout で構築済みの決済ページにさらにフィールドを追加します。

ページをコピー

決済フォームにカスタムフィールドを追加すると、顧客から追加情報を収集できます。この情報は、支払いの完了後に使用できるようになり、購入のフルフィルメントに利用できます。

カスタムフィールドには以下の制限があります。

  • フィールドは 3 つまで使用できます。
  • setup モードでは使用できません。
  • テキストフィールドで対応できるのは 255 文字までです。
  • 数値フィールドは、最大 255 桁に対応できます。
  • ドロップダウンフィールドでは最大 200 件のオプションを使用できます。

注意

カスタムフィールドは、個人情報、保護対象のデータ、機密データ、法律によって制限されている情報の収集には使用しないでください。

Checkout セッションを作成する

カスタムフィールドの配列を指定する際に、Checkout セッションを作成します。各フィールドには、実装でフィールドの照合に使用する一意の key が必要です。また、顧客に表示するフィールドのラベルも指定してください。カスタムフィールドのラベルは翻訳されませんが、locale パラメーターを使用して、Checkout セッションの言語をラベルの言語に一致させることができます。

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=1 \ -d "custom_fields[0][key]"=engraving \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Personalized engraving" \ -d "custom_fields[0][type]"=text
カスタムフィールドが設定された決済ページ

カスタムフィールドを取得する

顧客が Checkout セッションを完了すると、フィールドが入力されたことを示す checkout.session.completed Webhook が送信されます。

以下に checkout.session.completed ペイロードの例を示します。

{ "id": "evt_1Ep24XHssDVaQm2PpwS19Yt0", "object": "event", "api_version": "2022-11-15", "created": 1664928000, "data": { "object": { "id": "cs_test_MlZAaTXUMHjWZ7DcXjusJnDU4MxPalbtL5eYrmS2GKxqscDtpJq8QM0k", "object": "checkout.session", "custom_fields": [{ "key": "engraving", "label": { "type": "custom", "custom": "Personalized engraving" }, "optional": false, "type": "text", "text": { "value": "Jane", } }], "mode": "payment", } }, "livemode": false, "pending_webhooks": 1, "request": { "id": null, "idempotency_key": null }, "type": "checkout.session.completed" }

カスタムフィールドを使用する

フィールドにオプションのマークを付ける

デフォルトでは、顧客は、支払いを完了する前に、すべてのフィールドに入力する必要があります。フィールドにオプションのマークを付けるには、optional=true を渡します。

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=1 \ -d "custom_fields[0][key]"=engraving \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Personalized engraving" \ -d "custom_fields[0][type]"=text \ -d "custom_fields[0][optional]"=true

ドロップダウンフィールドを追加する

ドロップダウンフィールドに、選択するオプションのリストが顧客に表示されます。ドロップダウンフィールドを作成するには、type=dropdown とオプションのリストを指定し、それぞれにlabel と value を指定します。label は顧客に表示され、実装では、value を使用して、顧客が選択したオプションを照合します。

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=1 \ -d "custom_fields[0][key]"=sample \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Free sample" \ -d "custom_fields[0][optional]"=true \ -d "custom_fields[0][type]"=dropdown \ -d "custom_fields[0][dropdown][options][0][label]"="Balm sample" \ -d "custom_fields[0][dropdown][options][0][value]"=balm \ -d "custom_fields[0][dropdown][options][1][label]"="BB cream sample" \ -d "custom_fields[0][dropdown][options][1][value]"=cream
ドロップダウンフィールドが設定された決済ページ

数値のみのフィールドを追加する

数値のみのフィールドは、255 桁までの数値のみを受け付けるテキストフィールドを顧客に提供します。数値のみのフィールドを作成するには、type=numeric を指定します。

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=1 \ -d "custom_fields[0][key]"=invoice \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Invoice number" \ -d "custom_fields[0][type]"=numeric

サブスクリプションのカスタムフィールドを取得する

subscription パラメーターを使用して作成した Checkout セッションのクエリを実行することで、サブスクリプションに関連付けられているカスタムフィールドを取得できます。

Command Line
cURL
curl -G https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d subscription=
{{SUBSCRIPTION_ID}}

文字数の検証を追加する

必要に応じて text フィールドタイプと numeric フィールドタイプの最小文字数と最大文字数の要件を指定できます。

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=1 \ -d "custom_fields[0][key]"=engraving \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Personalized engraving" \ -d "custom_fields[0][type]"=text \ -d "custom_fields[0][text][minimum_length]"=10 \ -d "custom_fields[0][text][maximum_length]"=20 \ -d "custom_fields[0][optional]"=true
字数制限が設定されたフィールド

デフォルト値を追加する

必要に応じて、テキスト、数値、およびドロップダウンフィールドタイプのデフォルト値を指定できます。デフォルト値は、支払いページに事前入力されています。

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"=
{{PRICE_ID}}
\ -d "line_items[0][quantity]"=1 \ -d "custom_fields[0][key]"=engraving \ -d "custom_fields[0][label][type]"=custom \ -d "custom_fields[0][label][custom]"="Personalized engraving" \ -d "custom_fields[0][type]"=text \ -d "custom_fields[0][text][default_value]"=Stella \ -d "custom_fields[1][key]"=size \ -d "custom_fields[1][label][type]"=custom \ -d "custom_fields[1][label][custom]"=Size \ -d "custom_fields[1][type]"=dropdown \ -d "custom_fields[1][dropdown][default_value]"=small \ -d "custom_fields[1][dropdown][options][0][value]"=small \ -d "custom_fields[1][dropdown][options][0][label]"=Small \ -d "custom_fields[1][dropdown][options][1][value]"=large \ -d "custom_fields[1][dropdown][options][1][label]"=Large
このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc