Accéder directement au contenu
Créez un compte
ou
connecter-vous
Logo de la documentation Stripe
/
Ask AI
Créez un compte
Connectez-vous
Démarrer
Paiements
Automatisation des opérations financières
Plateformes et places de marché
Gestion de fonds
Outils de développement
Démarrer
Paiements
Automatisation des opérations financières
Démarrer
Paiements
Automatisation des opérations financières
Plateformes et places de marché
Gestion de fonds
Aperçu
À propos des paiements Stripe
Mettre votre intégration à niveau
Analyses des paiements
Paiements en ligne
PrésentationTrouver votre cas d'usageManaged Payments
Utiliser Payment Links
Créer une page de paiement
Développer une intégration avancée
Développer une intégration dans l'application
Moyens de paiement
Ajouter des moyens de paiement
    Présentation
    Options d'intégration des moyens de paiement
    Gérer les moyens de paiement par défaut dans le Dashboard
    Types de moyens de paiement
    Cartes bancaires
    Prélèvements bancaires
    Virements avec redirection bancaire
    Virements bancaires
    Virements (Sources)
    Achetez maintenant, payez plus tard
      Affirm
      Afterpay/Clearpay
      Alma
      Billie
      Capchase Pay
      Klarna
        Accepter un paiement
        Répondre aux litiges
      Kriya
      Mondu
      Paiement sur facture
      Scalapay
      SeQura
      Sunbit
      Zip
    Paiements en temps réel
    Coupons
    Portefeuilles
    Activer des moyens de paiement locaux par pays
    Moyens de paiement personnalisés
Gérer les moyens de paiement
Paiement accéléré avec Link
Interfaces de paiement
Payment Links
Checkout
Web Elements
Elements intégrés à l'application
Scénarios de paiement
Tunnels de paiement personnalisés
Acquisition flexible
Orchestration
Paiements par TPE
Terminal
Autres produits Stripe
Financial Connections
Cryptomonnaies
Climate
AccueilPaiementsAdd payment methodsBuy now, pay laterKlarna

Remarque

Cette page n'est pas encore disponible dans cette langue. Nous faisons tout notre possible pour proposer notre documentation dans davantage de langues et nous vous fournirons la version traduite dès qu'elle sera disponible.

Accept a Klarna payment

Learn how to accept Klarna, a global buy now, pay later payment method.

Copier la page

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.

When a customer chooses Klarna in your app, a webview for them to authenticate their payment appears. After the customer is redirected back to your app, you can immediately confirm whether the payment succeeded or failed.

Remarque

Before starting your integration, check that your account is eligible for Klarna on the Payment methods settings.

Set up Stripe
Server-side
Client-side

Server-side

This integration requires endpoints on your server that talk to the Stripe API. Use our official libraries for access to the Stripe API from your server:

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'

Client-side

The React Native SDK is open source and fully documented. Internally, it uses the native iOS and Android SDKs. To install Stripe’s React Native SDK, run one of the following commands in your project’s directory (depending on which package manager you use):

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

Next, install some other necessary dependencies:

  • For iOS, navigate to the ios directory and run pod install to ensure that you also install the required native dependencies.
  • For Android, there are no more dependencies to install.

Stripe initialization

To initialize Stripe in your React Native app, either wrap your payment screen with the StripeProvider component, or use the initStripe initialization method. Only the API publishable key in publishableKey is required. The following example shows how to initialize Stripe using the StripeProvider component.

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> ); }

Remarque

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

Create a PaymentIntent
Server-side
Client-side

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.

Server-side

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

Client-side

A PaymentIntent includes a client secret. You can use the client secret in your React Native app to securely complete the payment process instead of passing back the entire PaymentIntent object. In your app, request a PaymentIntent from your server and store its 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>; }

Submit the payment to Stripe
Client-side

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!`); } };

Test Klarna integration

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.

ApprovedDenied
Date of Birth10-07-197003-05-1994
First NameTestJohn
Last NamePerson-ausnow
StreetWharf StSilverwater Rd
House number41-5
Postal Code48772128
CityPort DouglasSilverwater
RegionQLDNSW
Phone+61473752244+61473763254
Emailcustomer@email.aucustomer+denied@email.au

Two-step authentication

Any six digit number is a valid two-step authentication code. Use 999999 for authentication to fail.

Repayment method

Inside the Klarna flow, you can use the following test values to try various repayment types:

TypeValue
Direct DebitDE11520513735120710131
Bank transferDemo Bank
Credit Card
  • Number: 4111 1111 1111 1111
  • CVV: 123
  • Expiration: any valid date in the future
Debit Card
  • Number: 4012 8888 8888 1881
  • CVV: 123
  • Expiration: any valid date in the future

FacultatifSeparate authorization and capture

FacultatifHandle post-payment events

FacultatifCustomize the Klarna payment page

FacultatifAdd line items to the PaymentIntent

Failed payments

Klarna takes into account multiple factors when deciding to accept or decline a transaction (for example, length of time buyer has been using Klarna, outstanding amount customer has to repay, value of the current order).

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.

In these cases, inform your customer to try again with a different payment option presented in your checkout flow.

Klarna rate limits

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.

Error messaging

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

Mise en garde

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.

Failure codeExplanation
payment_method_customer_declineThe customer cancelled the checkout on Klarna’s page
payment_method_provider_declineKlarna declined the customer’s payment
payment_intent_payment_attempt_expiredThe customer never completed the checkout on Klarna’s page, and the payment session has expired
payment_method_not_availableAn unexpected error occurred when trying to use Klarna
Cette page vous a-t-elle été utile ?
OuiNon
Besoin d'aide ? Contactez le service Support.
Rejoignez notre programme d'accès anticipé.
Consultez notre log des modifications.
Des questions ? Contactez l'équipe commerciale.
LLM ? Lire llms.txt.
Propulsé par Markdoc