コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
Ask AI
アカウントを作成
サインイン
始める
支払い
財務の自動化
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
始める
支払い
財務の自動化
始める
支払い
財務の自動化
プラットフォームおよびマーケットプレイス
資金管理
概要
Stripe Payments について
構築済みのシステムをアップグレード
支払いの分析
オンライン決済
概要ユースケースを見つけるManaged Payments
Payment Links を使用する
決済ページを構築
高度なシステムを構築
アプリ内実装を構築
支払い方法
決済手段を追加
    概要
    支払い方法の導入オプション
    ダッシュボードで支払い方法を管理
    決済手段のタイプ
    カード
    銀行口座引き落とし
    銀行へのリダイレクト
    銀行振込
    クレジットトランスファー (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 API と通信するエンドポイントがサーバ上に必要です。Stripe の公式ライブラリを使用して、サーバから Stripe API にアクセスします。

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'

クライアント側

React Native SDK はオープンソースであり、詳細なドキュメントが提供されています。内部では、ネイティブの iOS および Android の SDK を使用します。Stripe の React Native SDK をインストールするには、プロジェクトのディレクトリーで (使用するパッケージマネージャーによって異なる) 次のいずれかのコマンドを実行します。

Command Line
yarn add @stripe/stripe-react-native

次に、その他の必要な依存関係をインストールします。

  • iOS の場合は、ios ディレクトリーに移動して pod install を実行し、必要なネイティブ依存関係もインストールします。
  • Android の場合は、依存関係をインストールする必要はありません。

Stripe の初期化

React Native アプリで Stripe を初期化するには、決済画面を StripeProvider コンポーネントでラップするか、initStripe 初期化メソッドを使用します。publishableKey の API 公開可能キーのみが必要です。次の例は、StripeProvider コンポーネントを使用して Stripe を初期化する方法を示しています。

import { StripeProvider } from '@stripe/stripe-react-native'; function App() { const [publishableKey, setPublishableKey] = useState(''); const fetchPublishableKey = async () => { const key = await fetchKey(); // fetch key from your server here setPublishableKey(key); }; useEffect(() => { fetchPublishableKey(); }, []); return ( <StripeProvider publishableKey={publishableKey} merchantIdentifier="merchant.identifier" // required for Apple Pay urlScheme="your-url-scheme" // required for 3D Secure and bank redirects > // Your app code here </StripeProvider> ); }

注

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

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

Stripe uses a PaymentIntent object to represent your intent to collect payment from a customer, tracking your charge attempts and payment state changes throughout the payment process.

サーバー側

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 が含まれています。これを React Native アプリで使用することで、PaymentIntent オブジェクト全体を渡すことなく安全に支払いプロセスを完了できます。アプリで、サーバーの PaymentIntent をリクエストし、その client secret を保存します。

function PaymentScreen() { // ... const fetchPaymentIntentClientSecret = async () => { const response = await fetch(`${API_URL}/create-payment-intent`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ currency: 'eur', }), }); const {clientSecret} = await response.json(); return clientSecret; }; return <View>...</View>; }

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

Submitting the payment to Stripe requires the client secret from the PaymentIntent that you created. Include it in your call to confirmPayment:

import {Picker} from '@react-native-picker/picker'; import {confirmPayment} from '@stripe/stripe-react-native'; export default function MyPaymentScreen() { const handlePayPress = async () => { // Fetch the intent client secret from the backend. // See `fetchPaymentIntentClientSecret()`'s implementation above. const clientSecret = await fetchPaymentIntentClientSecret(); const {error, paymentIntent} = await confirmPayment(clientSecret, { paymentMethodType: 'Klarna' }, }); if (error) { console.log('Payment confirmation error', error.message); // Update UI to prompt user to retry payment (and possibly another payment method) } else if (paymentIntent) { Alert.alert('Success', `The payment was confirmed successfully!`); } };

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