コンテンツにスキップ
アカウント作成/サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成サインイン
導入方法
決済管理
売上管理
プラットフォームとマーケットプレイス
資金管理
開発者向けリソース
API & SDKヘルプ
概要
Stripe Payments について
構築済みのシステムをアップグレード
決済分析
オンライン決済
概要ユースケースを見つけるManaged Payments を使用する
Payment Links を使用する
事前構築済みの決済ページを使用する
Elements を使用したカスタム統合の構築
アプリ内実装を構築
    概要
    Payment Sheet
    Payment Element
    Address Element
    Payment Method Messaging Element
      Display BNPL messaging
    アプリ内購入のリンク
    設定で決済手段を管理する
    Confirmation Tokens に移行
    アメリカとカナダのカード
対面決済
Terminal
決済手段
決済手段を追加
決済手段を管理
Link による購入の迅速化
決済シナリオ
複数の通貨を扱う
カスタムの決済フロー
柔軟なアクワイアリング
オーケストレーション
決済以外の機能
会社を設立する
暗号資産
エージェント型コマース
Financial Connections
Climate
不正利用について
Radar の不正防止
不審請求の申請の管理
本人確認
アメリカ
日本語
ホーム決済管理Build an in-app integrationPayment Method Messaging Element

メモ

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

Display BNPL Messaging公開プレビュー

Automatically explain buy now, pay later payment options.

To display promotional messaging for buy now, pay later payment options, use the Payment Method Messaging Element.

Set up Stripe
Server-side
Client-side

まず、Stripe アカウントが必要です。今すぐ登録してください。

Stripe iOS SDK はオープンソースです。詳細なドキュメントが提供されており、iOS 13 以降をサポートするアプリと互換性があります。

SDK をインストールするには、以下のステップに従います。

  1. Xcode で、File (ファイル) > Add Package Dependencies… (パッケージ依存関係を追加) を選択し、リポジトリー URL として https://github.com/stripe/stripe-ios-spm を入力します。
  2. リリースページから最新のバージョン番号を選択します。
  3. StripePaymentSheet 製品をアプリのターゲットに追加します。

メモ

SDK の最新リリースおよび過去バージョンの詳細については、GitHub の Releases (リリース) ページをご覧ください。リポジトリのリリースをウォッチして、新しいリリースの公開時に通知を受け取ることも可能です。

アプリの起動時に Stripe 公開可能キーを使用して SDK を設定します。これにより、アプリが Stripe API にリクエストを送信できるようになります。

AppDelegate.swift
Swift
No results
import UIKit import StripePaymentSheet @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey =
"pk_test_TYooMQauvdEDq54NiTphI7jx"
// do any other necessary launch configuration return true } }

メモ

テストおよび開発時にはテストキーを使用し、アプリの公開時には本番環境キーを使用します。

Initialize the Payment Method Messaging Element

Call create to instantiate the Payment Method Messaging Element with a PaymentMethodMessagingElement.Configuration. The Configuration object contains details about the potential purchase and how information about it should be displayed. After PaymentMethodMessagingElement has successfully initialized, put its view into your UI.

@_spi(PaymentMethodMessagingElementPreview) import StripePaymentSheet class MyViewController: UIViewController { private var amount = 1000 // $10.00 private var currency = "USD" private var paymentMethodMessagingElementView: UIView? func addPaymentMethodMessagingElement() { Task { @MainActor in // Create configuration object let configuration = PaymentMethodMessagingElement.Configuration( amount: amount, currency: currency, ) // Create PaymentMethodMessagingElement switch await PaymentMethodMessagingElement.create(configuration: configuration) { case .success(let element): let elementView = element.view self.view.addSubview(elementView) self.paymentMethodMessagingElementView = elementView // Set up constraints for elementView NSLayoutConstraint.activate([( // .. )]) case .noContent: // No element is available to display with this configuration // You may want to adapt your UI accordingly // ... case .failed(let error): // An unrecoverable error has occurred while attempting to load the element // You may want to log the error or take other action // ... } } } override func viewDidLoad() { super.viewDidLoad() // Set up the remainder of your page // ... addPaymentMethodMessagingElement() } }

オプションUpdate the element

If the customer performs an action that changes the configuration (for example, selecting a different product variant), initialize a new PaymentMethodMessagingElement instance to reflect the new information.

class MyViewController: UIViewController { // ... func updatePaymentMethodMessagingElement() { paymentMethodMessagingElementView?.removeFromSuperview() addPaymentMethodMessagingElement() } }

オプションCustomize the element

Customization options are available through the PaymentMethodMessagingElement.Configuration and PaymentMethodMessagingElement.Appearance objects.

// Configure appearance let appearance = PaymentMethodMessagingElement.Appearance( style: .flat, font: .boldSystemFont(ofSize: 12), textColor: .black, infoIconColor: .blue ) // Create configuration object let configuration = PaymentMethodMessagingElement.Configuration( amount: 1000, // $10.00 currency: "USD", locale: "en_GB", // Defaults to device locale but can be explicitly set countryCode: "US", // Defaults to customer IP address but can be explicitly set paymentMethodTypes: [.affirm, .klarna], // Defaults to dynamic payment methods from the Dashboard, but can be explicitly set appearance: appearance )
このページはお役に立ちましたか。
はいいいえ
  • お困りのことがございましたら 、サポートにお問い合わせください。
  • 変更ログをご覧ください。
  • ご不明な点がございましたら、お問い合わせください。
  • LLM ですか?llms.txt を読んでください。
  • Powered by Markdoc