コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
Stripe Payments について
構築済みのシステムをアップグレード
支払いの分析
オンライン決済
概要ユースケースを見つけるManaged Payments
Payment Links を使用する
決済ページを構築
高度なシステムを構築
アプリ内実装を構築
決済手段
決済手段を追加
    概要
    支払い方法の導入オプション
    ダッシュボードで支払い方法を管理
    決済手段のタイプ
    カード
    Stripe 残高で支払う
    仮想通貨
    銀行口座引き落とし
    銀行へのリダイレクト
    銀行振込
    クレジットトランスファー (Sources)
    後払い
      Affirm
      Afterpay/Clearpay
      Alma
      Billie
      Capchase Pay
      Klarna
        決済を受け付ける
        不審請求の申請への対応
      Kriya
      Mondu
      請求書支払い
      Scalapay
      SeQura
      Sunbit
      Zip
    リアルタイム決済
    店舗支払い
    ウォレット
    国ごとに現地の支払い方法を有効化
    カスタムの決済手段
決済手段を管理
Link による購入の迅速化
支払いインターフェイス
Payment Links
Checkout
Web Elements
アプリ内 Elements
決済シナリオ
カスタムの決済フロー
柔軟なアクワイアリング
オーケストレーション
店頭支払い
端末
他の Stripe プロダクト
Financial Connections
仮想通貨
Climate
ホーム支払いAdd payment methodsBuy now, pay laterKlarna

注

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

Klarna による支払い方法を受け付ける

世界で普及している後払いの支払い方法である Klarna を受け付ける方法をご紹介します。

ページをコピー

Unified line items with Klarna

To optimize approval rates when you integrate with Klarna, include line_items data to represent what’s in a shopper’s cart. For early access, see Payments line items.

顧客がアプリで Klarna を受け付ける際に、顧客が支払いを認証するための Webview が表示されます。その後、顧客はアプリに戻り、お客様は支払いが成功したか失敗したかをすぐに確認できます。

注

導入を開始する前に、支払い方法の設定に移動して、アカウントで Klarna が使用可能であることを確認してください。

Stripe を設定する
サーバ側
クライアント側

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

サーバ側

この組み込みには、サーバ上に Stripe API と通信するエンドポイントが必要です。サーバから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

クライアント側

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

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

  1. In Xcode, select File > Add Package Dependencies… and enter https://github.com/stripe/stripe-ios-spm as the repository URL.
  2. リリースページから最新のバージョン番号を選択します。
  3. StripePaymentsUI 製品をアプリのターゲットに追加します。

注

For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository.

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

AppDelegate.swift
Swift
import UIKit import StripePaymentsUI @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 } }

注

Use your test keys while you test and develop, and your live mode keys when you publish your app.

PaymentIntent を作成する
サーバー側
クライアント側

A PaymentIntent is an object that represents your intent to collect payment from a customer and tracks the lifecycle of the payment process through each stage.

サーバー側

First, create a PaymentIntent on your server and specify the amount to collect and the currency. If you already have an integration using the Payment Intents API, add klarna to the list of payment method types for your PaymentIntent.

Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "payment_method_types[]"=klarna \ -d amount=1099 \ -d currency=eur

クライアント側

返される PaymentIntent には client secret が含まれています。これは、PaymentIntent オブジェクト全体を渡すことなく安全に決済を完了するために、クライアント側で使用されます。クライアント側で、サーバーに PaymentIntent をリクエストし、その client secret を保存します。

Swift
import UIKit import StripePaymentsUI class CheckoutViewController: UIViewController { var paymentIntentClientSecret: String? func startCheckout() { // Request a PaymentIntent from your server and store its client secret } }}

Stripe に支払いを送信する
クライアント側

ステップ 2 で作成した PaymentIntent から client secret を取得し、STPPaymentHandler confirmPayment: メソッドを呼び出します。これにより WebView が表示され、顧客はここで支払いを完了します。それによって支払い結果を含む完了ブロックの呼び出しが開始されます。

Swift
let paymentIntentParams = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret) paymentIntentParams.paymentMethodParams = klarnaParams paymentIntentParams.shipping = shippingDetails STPPaymentHandler.shared().confirmPayment(paymentIntentParams, with: self) { (handlerStatus, paymentIntent, error) in switch handlerStatus { case .succeeded: // Payment succeeded case .canceled: // Payment was canceled case .failed: // Payment failed @unknown default: fatalError() } }

Klarna の組み込みをテストする

Below, we have specially selected test data for the currently supported customer countries. In a sandbox, Klarna approves or denies a transaction based on the supplied email address.

承認拒否
生年月日1970/10/0703-05-1994
名テストJohn
姓Person-ausnow
町名・番地Wharf StSilverwater Rd
番地等41-5
郵便番号48772128
市区町村Port DouglasSilverwater
地域QLDNSW
電話番号+61473752244+61473763254
メールアドレスcustomer@email.aucustomer+denied@email.au

2 段階認証

6 桁の数字であれば、2 段階認証コードとして有効です。999999 を使用すると、認証は失敗します。

返済方法

Klarna のフロー内では、以下のテスト値を使用し、さまざまな返済方法を試すことができます。

タイプ値
口座引き落としDE11520513735120710131
銀行振込デモの銀行
クレジットカード
  • 番号: 4111 1111 1111 1111
  • CVV: 123
  • 有効期限: 任意の将来日付
Debit Card
  • Number: 4012 8888 8888 1881
  • CVV: 123
  • 有効期限: 任意の将来日付

オプションオーソリとキャプチャーの分離

オプション支払い後のイベントを処理する

オプションKlarna 支払いページをカスタマイズする

オプションPaymentIntent にラインアイテムを追加する

失敗した支払い

Klarna は、取引を受け付けるか拒否するかを決定する際に複数の要因を考慮します (買い手が Klarna を使用している期間、顧客が返済する必要のある未払い額、現在の注文の金額など)。

When the customer selects a deferred payment method, Klarna performs a risk assessment before accepting the transaction. Klarna might decline the transaction due to unsatisfactory risk assessment result, the transaction amount involved, or the customer having a large outstanding debt. As such, we recommend that you present additional payment options such as card in your checkout flow. In these cases, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_payment_method.

Customers are expected to complete the payment within 48 hours after they’re redirected to the Klarna site. If no action is taken after 48 hours, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions from requires_action to requires_payment_method.

このようなケースでは、決済フローに表示される別の支払いオプションで再試行するように顧客に通知します。

Klarna のレート制限

API requests to Klarna are subject to additional rate limits beyond Stripe’s API-wide rate limits. These limits can differ depending on the shape of the API requests that you make. In general, if you make more than around 360 requests per minute, you may see some rate limiting in the form of responses with HTTP status code 400 or 402. Please contact us for more details if you’re concerned that your usage may reach these levels, as Klarna may be able to increase these limits on a case by case basis.

エラーメッセージ

Failed Klarna payments normally return one of the following failure codes. These codes show in the last_payment_error API object.

注意

Before the 2023-08-16 API version, every Klarna error reported as payment_intent_authentication_failure. Make sure your API version is up to date to see the detailed errors listed below.

エラーコード説明
payment_method_customer_decline顧客が Klarna のページで購入をキャンセルしました
payment_method_provider_declineKlarna が顧客の支払いを拒否しました
payment_intent_payment_attempt_expired顧客が Klarna のページで購入を完了しないまま、支払いセッションの有効期限が切れました
payment_method_not_availableKlarna を使用しようとしたときに予期しないエラーが発生しました
このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc