コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
財務の自動化
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
始める
支払い
財務の自動化
始める
支払い
財務の自動化
プラットフォームおよびマーケットプレイス
資金管理
概要
Stripe Payments について
構築済みのシステムをアップグレード
支払いの分析
オンライン決済
概要ユースケースを見つけるManaged Payments
Payment Links を使用する
決済ページを構築
高度なシステムを構築
アプリ内実装を構築
決済手段
決済手段を追加
決済手段を管理
Link による購入の迅速化
支払いインターフェイス
Payment Links
Checkout
Web Elements
アプリ内 Elements
決済シナリオ
カスタムの決済フロー
柔軟なアクワイアリング
オーケストレーション
店頭支払い
端末
    概要
    対面支払いを受け付ける
    導入方法の設計
    リーダーを選択
    導入方法の設計
    クイックスタート
    サンプルアプリケーション
    テスト
    Terminal の設定
    実装方法を設定する
    リーダーに接続する
    決済の受け付け
    カード支払いを回収
    追加の支払い方法
    オフライン決済を受け付ける
      カード支払いを回収
    通信販売/電話販売の決済
    地域的な考慮事項
    購入時
    チップを回収する
    将来の使用に備えて支払い情報を収集して保存する
    柔軟なオーソリ
    決済後
    返金の取引
    領収書の提供
    Checkout のカスタマイズ
    カートの表示
    画面上の入力を収集
    スワイプで取得されたデータを収集
    NFC 機器のタップによって取得したデータを収集
    Apps on Devices
    リーダーを管理
    リーダーの注文、返品、交換
    リーダーの登録
    場所とゾーンの管理
    リーダーの設定
    Monitor Readers
    暗号化
    リファレンス
    API リファレンス
    モバイルリーダー
    スマートリーダー
    SDK 移行ガイド
    デプロイのチェックリスト
    Stripe Terminal リーダー製品シート
他の Stripe プロダクト
Financial Connections
仮想通貨
Climate
ホーム支払いTerminalAccept offline payments

注

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

オフラインでカード支払いを回収する

インターネット接続の問題が生じているときにカード支払いを回収します。

ページをコピー

The Terminal SDK allows your application to continue collecting payments using a mobile reader without a network connection.

よくある間違い

When operating offline, payment information is collected at the time of sale, and authorization is only attempted after connectivity is restored and the payment is forwarded. You, as the user, assume all decline and tamper-related risks associated with an offline transaction. If your tampered reader can’t forward payments to Stripe, or the issuer declines the transaction, there’s no way to recover the funds, and you might not receive payment from the customer for goods or services already provided.

カード発行会社による拒否を減らすため、以下のことが推奨されます。

  • できる限り早急にインターネット接続を再確立して、支払いを Stripe に記録します。
  • 所定の金額を超える場合は取引を制限します。
  • Fail all offline payments if the SDK has stored a set of transactions whose sum exceeds a certain amount.

オフライン中に決済を回収する

オフライン決済の手順は、オンライン決済と同じで、決済の作成、回収、処理、およびキャプチャーが含まれます。このプロセスのどの段階でも、デバイスをオンラインからオフラインにできます。

  1. オフラインモードを有効にする
  2. オフライン中にリーダーに接続する
  3. オフラインイベントを処理する
  4. オフライン中に PaymentIntent を作成する
  5. 支払い方法を収集する
  6. 支払いを確定する
  7. 支払いが転送されるまで待つ
  8. (オプション) 支払いをキャプチャーする
  9. (Optional) Examine payments collected offline

オフラインモードを有効にする

オフラインモードを使用するには、アプリケーションが Terminal iOS SDK のバージョン 3.3.0 以降を使用している必要があります。

Use a Configuration object to enable offline mode for the supported devices at your Location.

Command Line
cURL
curl https://api.stripe.com/v1/terminal/configurations \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "offline[enabled]"=true

After you enable offline mode on a Configuration object, you can assign it to a Location. You can also enable offline mode by default for all Locations by updating the default Configuration object for your account. Configuration API changes can take several minutes to propagate to your SDK and reader, and require you to disconnect from and reconnect to your reader to take effect.

オフライン中にリーダーに接続する

The SDK stores necessary Location information locally after connecting online. On subsequent offline connections, it uses the stored configuration information from that Location.

To collect payments with a smart reader while offline, you must have previously connected to any mobile reader of the same type at the same Location while online within the last 30 days, and have updated your reader’s software within that time.

If you attempt to connect to a reader while offline without meeting these requirements, the request fails with an error.

エラー解決策
The SDK isn’t connected to the internetMake sure the Location you’re using is configured for offline mode. Otherwise, connect to any reader while online, and then connect to a reader of the same type while offline.
選択したリーダーをオフラインでの支払い回収に使用するには、ソフトウェアの更新が必要です。The reader’s software hasn’t been updated in 30 days or more. Connect to the reader while online to update it.
選択したリーダーをオフラインでの支払い回収に使用するには、この場所でオンラインのペアリングを行う必要があります。POS がこれまでオンライン中に接続していないタイプのリーダーに接続しようとしています。まずオンライン中に、このリーダーまたは同じタイプのリーダーに接続する必要があります。または、オフライン中に接続する場合は、以前オンライン中に POS が接続していたタイプのリーダーに接続できます。

If you reinstall the application or perform any operation that clears the disk storage for the SDK (such as clearing your POS app’s cache in the POS device’s settings) you lose any payments that the SDK has stored and not yet forwarded. Make sure there are no stored payments before you perform any destructive action.

オフラインイベントを処理する
クライアント側

SDK リファレンス

  • OfflineDelegate (iOS)
  • NetworkStatus (iOS)

To allow your application to receive updates about the SDK’s network status and the state of forwarded payments, implement the OfflineDelegate protocol and pass it to the Terminal SDK. You must set OfflineDelegate before collecting payments offline.

CustomOfflineDelegate.swift
Swift
import StripeTerminal class CustomOfflineDelegate: OfflineDelegate { func terminal(_ terminal: Terminal, didChangeOfflineStatus offlineStatus: OfflineStatus) { // Check the value of `offlineStatus` and update your UI accordingly. For instance, // you can check the SDK's network status at `offlineStatus.sdk.networkStatus`. // // You can also check the SDK's current offline status using // `Terminal.shared.offlineStatus.sdk.networkStatus`. } func terminal(_ terminal: Terminal, didForwardPaymentIntent intent: PaymentIntent, error: Error?) { // The PaymentIntent was successfully forwarded, or an error occurred. // Reconcile any local state using the backend-generated `PaymentIntent.stripeId` // and the metadata you supplied when creating the PaymentIntent. // // Note that the `PaymentIntent.stripeId` may still be nil if creating the // PaymentIntent in the backend failed. } func terminal(_ terminal: Terminal, didReportForwardingError error: Error) { // A non-specific error occurred while forwarding a PaymentIntent. // Check the error message and your integration implementation to // troubleshoot. } }
AppDelegate.swift
Swift
import UIKit import StripeTerminal @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { Terminal.setTokenProvider(APIClient.shared) Terminal.shared.offlineDelegate = CustomOfflineDelegate() // ... return true } // ... }

オフライン中に PaymentIntent を作成する
クライアント側

SDK リファレンス

  • createPaymentIntent (iOS)
  • CreateConfiguration (iOS)
  • OfflineDetails (iOS)

To support operating offline, use the SDK’s createPaymentIntent to create PaymentIntent objects. This allows the SDK to create PaymentIntents while offline and forward them to Stripe after you’ve re-established connectivity.

While operating offline, PaymentIntent objects have a null stripeId. We recommend adding a custom identifier to the PaymentIntent’s metadata to help reconcile PaymentIntent objects created offline in your database.

After the PaymentIntent has been successfully forwarded to Stripe in Step 7, use your custom identifier to reconcile it in the OfflineDelegate.didForwardPaymentIntent callback.

PaymentViewController.swift
Swift
import UIKit import StripeTerminal class PaymentViewController: UIViewController { // Action for a "Checkout" button func checkoutAction() throws { // Populate the correct transaction amount from your application. let amount = UInt(10_00) // Build up parameters for creating a `PaymentIntent` let params = try PaymentIntentParametersBuilder( amount: amount, currency: "usd" ) .setMetadata(["offlineId": UUID().uuidString]) .build() Terminal.shared.createPaymentIntent(params) { createResult, createError in if let error = createError { // Handle errors in your application. print("createPaymentIntent failed: \(error)") } else if let paymentIntent = createResult { print("createPaymentIntent succeeded") // If the `PaymentIntent` was created offline, its `stripeId` field will be nil. if let onlineCreatedId = paymentIntent.stripeId { print("created online"); } else { print("created offline") } } } } }

The Terminal.createPaymentIntent accepts a CreateConfiguration parameter. By default, if you’re operating offline, the Terminal SDK stores all offline payments, then forwards them to Stripe’s backend when connectivity is restored.

To customize this behavior, you can pass in a CreateConfiguration object with an offlineBehavior attribute set to as REQUIRE_ONLINE, PREFER_ONLINE or FORCE_OFFLINE.

Managing risk

Setting offlineBehavior to REQUIRE_ONLINE fails the current transaction if you’re operating offline. For example, you might want to disallow transactions above a certain amount or disallow all offline transactions if the SDK has stored a set of transactions whose sum exceeds a certain amount.

SDK では、リスクを管理しやすいように、次の 2 つのプロパティーを公開しています。

  1. Terminal.offlineStatus.sdk.offlinePaymentsCount
  2. Terminal.offlineStatus.sdk.offlinePaymentAmountsByCurrency

オフライン時の遅延管理

Based on your network connectivity, the Terminal SDK automatically determines whether to collect payments online or offline. However, you might want to operate offline despite having an active network connection (for example, if you need to collect transactions quickly and your network connection is slow). You can pass a CreateConfiguration object with offlineBehavior set to FORCE_OFFLINE to collect the payment offline regardless of connectivity.

Payments collected offline while the Terminal SDK has an active network connection are forwarded in the background.

PaymentViewController.swift
Swift
import UIKit import StripeTerminal class PaymentViewController: UIViewController { // Action for a "Checkout" button func checkoutAction() throws { // ...build up parameters and callback for creating a `PaymentIntent` // Your app might want to prevent offline payments for too large an amount. // Here, we block the payment if the amount is over 1000 usd. // Otherwise, we allow collecting offline if the network connection is unavailable. let offlineBehavior: SCPOfflineBehavior = { if amount > UInt(1_000_00) { return .requireOnline } else { return .preferOnline } }() let createConfiguration = try CreateConfigurationBuilder().setOfflineBehavior(offlineBehavior).build() Terminal.shared.createPaymentIntent(params, createConfig: createConfiguration) { createResult, createError in // handle success or failure } } }

支払い方法を収集する
クライアント側

SDK リファレンス

  • didRequestReaderInput (iOS)
  • CollectConfiguration (iOS)

注

Payment liability is your responsibility when operating your reader offline. Because magnetic stripe data is easy to spoof, Stripe disallows this option while operating offline. Tapping cards is also not supported in markets where Strong Customer Authentication is required.

Collecting payments while offline is similar to collecting payments while online. Use the didRequestReaderInput method to display the valid card presentment options to the customer.

注

Inspecting payment method details before authorization isn’t supported while offline. Although you can still use the initWithUpdatePaymentIntent parameter in CollectConfiguration, the paymentMethod field on the PaymentIntent is absent if the SDK is operating offline.

PaymentViewController.swift
Swift
import UIKit import StripeTerminal class PaymentViewController: UIViewController { // Action for a "Checkout" button func checkoutAction() { Terminal.shared.collectPaymentMethod(paymentIntent) { collectResult, collectError in if let error = collectError { print("collectPaymentMethod failed: \(error)") } else if let paymentIntent = collectResult { print("collectPaymentMethod succeeded") // ... Confirm the payment } } } }

支払いを確定する
クライアント側

Confirming payments while offline is similar to confirming payments while online. The primary difference is that your integration must handle offline-specific error cases, such as when the transaction exceeds the Stripe-enforced offline maximum of 10,000 USD or equivalent in your operating currency.

In some cases, the SDK might create a PaymentIntent online, but confirm it while offline. When this happens, the PaymentIntent might have a non-null stripeId. If it was confirmed offline, offlineDetails will be defined and populated.

PaymentViewController.swift
Swift
import UIKit import StripeTerminal class PaymentViewController: UIViewController { // Action for a "Checkout" button func checkoutAction() { Terminal.shared.confirmPaymentIntent(paymentIntent) { confirmResult, confirmError in if let error = confirmError { // Handle offline-specific errors in your application (for example, // unsupported payment method). print("confirmPaymentIntent failed: \(error)") } else if let confirmedPaymentIntent= confirmResult { print("confirmPaymentIntent succeeded") if let offlineDetails = paymentIntent.offlineDetails { print("confirmed offline"); } else { print("confirmed online") } } } } }

領収書の提供

オフライン時に支払いの完了に使用されたカードの情報が必要になることがあります。たとえば、購入時の領収書を求める顧客に領収書を生成する必要がある場合などです。

If the PaymentIntent is confirmed offline, retrieve its OfflineCardPresentDetails from the paymentIntent.offlineDetails.offlineCardPresentDetails property.

This hash contains a ReceiptDetails property you can use to generate a receipt, as well as other card details like the cardholder name and card brand.

The account_type and authorization_response_code receipt fields are unavailable on PaymentIntents processed offline. Prebuilt email receipts are only sent after connectivity is restored and the payment is successfully captured.

支払いが転送されるまで待つ
クライアント側

インターネットアクセスが復旧すると、SDK は保存されていたオフラインの支払いの転送を自動的に開始します。

The SDK attempts to forward payments even if its network status is offline. This means your connection token provider might receive a request to provide a connection token even when the device is offline.

If you power off your POS device too soon, your payments might not be forwarded. You can query Terminal.offlineStatus.sdk.networkStatus to make sure your POS is online and can forward payments, and Terminal.offlineStatus.sdk.offlinePaymentsCount to check how many payments the Terminal SDK has to be forwarded.

決済をキャプチャーする

While offline, you can create PaymentIntents with captureMethod set to automatic.

After you confirm these PaymentIntents, they have a Succeeded status instead of RequiresCapture. Stripe automatically captures the payments after you forward them.

If you opt for manual capture, payments that are successfully forwarded and authorized require capture from your backend or application.

  • To capture payments from your backend, use webhooks to listen for PaymentIntents with a requires_capture status.
  • To capture payments from your application, wait for your application to receive calls to OfflineDelegate.didForwardPayment for each PaymentIntent as the SDK forwards it. A PaymentIntent is ready to capture if its status is RequiresCapture and the offlineDetails is null or has a requiresUpload value of NO .
PaymentViewController.swift
Swift
Terminal.shared.confirmPaymentIntent(paymentIntent) { confirmResult, confirmError in if let error = confirmError { // Handle offline-specific errors in your application (for example, // unsupported payment method). print("confirmPaymentIntent failed: \(error)") } else if let confirmedPaymentIntent = confirmResult { if intent.status == .requiresCapture { if let offlineDetails = confirmedPaymentIntent.offlineDetails(), offlineDetails.requiresUpload { // Offline payment, wait for `didForwardPaymentIntent` (see snippet below) } else { // Online payment, can be captured now } } // else, handle other intent.status results here } }

オフライン決済は、 SDK によって OfflineDelegate の didForwardPaymentIntent で転送された後にキャプチャーします。

CustomOfflineDelegate.swift
Swift
import StripeTerminal class CustomOfflineDelegate: OfflineDelegate { // ... func terminal(_ terminal: Terminal, didForwardPaymentIntent intent: PaymentIntent, error: Error?) { if let error = error { // Handle the error appropriate for your application return } if intent.status == .requiresCapture { // The intent is ready to be captured. } else { // Handle the intent.status as appropriate. } } // ... }

オフラインで回収した支払いを調べる

After authorization, you can use the PaymentIntents API to examine offline details on a payment. Access the payment method details on the latest Charge object on a PaymentIntent to determine if it was collected offline.

このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc