Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Pay with Stripe balance
    Crypto
    Bank debits
    Bank redirects
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
    Real-time payments
    Vouchers
    Wallets
      Alipay
      Amazon Pay
      Apple Pay
      Cash App Pay
      Google Pay
      GrabPay
      Link
      MB WAY
      MobilePay
      PayPal
        PayPal button
        Activate PayPal payments
        Accept a payment
        Set up future payments
        Choose settlement preference
        Disputed payments
        Payout reconciliation
        Supported locales
        Import saved PayPal payment methods
      PayPay
      Revolut Pay
      Satispay
      Secure Remote Commerce
      Vipps
      WeChat Pay
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
HomePaymentsAdd payment methodsWalletsPayPal

Accept a PayPal payment

Learn how to accept PayPal payment, a digital wallet popular with businesses in Europe.

Copy page

Set up Stripe
Server-side
Client-side

First, you need a Stripe account. Register now.

Server-side

This integration requires endpoints on your server that talk to the Stripe API. Use the 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 Stripe Android SDK is open source and fully documented.

To install the SDK, add stripe-android to the dependencies block of your app/build.gradle file:

build.gradle.kts
Kotlin
plugins { id("com.android.application") } android { ... } dependencies { // ... // Stripe Android SDK implementation("com.stripe:stripe-android:21.18.0") // Include the financial connections SDK to support US bank account as a payment method implementation("com.stripe:financial-connections:21.18.0") }

Note

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.

Configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API, such as in your Application subclass:

Kotlin
import com.stripe.android.PaymentConfiguration class MyApp : Application() { override fun onCreate() { super.onCreate() PaymentConfiguration.init( applicationContext,
"pk_test_TYooMQauvdEDq54NiTphI7jx"
) } }

Note

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

Stripe samples also use OkHttp and GSON to make HTTP requests to a server.

Create a PaymentIntent
Server-side
Client-side

Server-side

Stripe uses a payment object, called a PaymentIntent, to track and handle all the states of the payment until it’s completed. Create a PaymentIntent on your server, specifying the amount to collect and the currency. If you already have an integration using the Payment Intents API, add paypal 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 amount=1099 \ -d currency=eur \ -d "payment_method_types[]"=paypal

Included in the returned PaymentIntent is a client secret, which is used to securely complete the payment process instead of passing the entire PaymentIntent object. Send the client secret back to the client so you can use it in later steps.

Include a custom description

By default, the order details on the PayPal users purchase activity page displays the order amount. You can change this by providing a custom description in the description property.

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

Customize the preferred locale

By default, the PayPal authorization page is localized based on variables such as the merchant’s country. You can set this to your customer’s preferred locale using the preferred_locale property. The value must be a two-character lowercased language code, followed by a hyphen (-), followed by a two-character uppercased country code. For example, the value for a French-language user in Belgium would be fr-BE. See supported locales for more information.

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

Statement descriptors with PayPal

The descriptor that appears on the buyer’s bank statement is set by PayPal, and by default is PAYPAL *YOUR_BUSINESS_NAME. If you set the statement_descriptor field when creating the PaymentIntent, its value is appended to the one set by PayPal, up to a total limit of 22 characters.

For example, if your business name in PayPal is BUSINESS and you set statement_descriptor to order_id_1234, buyers see PAYPAL *BUSINESS order on their bank account statement.

Client-side

On the client, request a PaymentIntent from your server and store its client secret.

CheckoutActivity.kt
Kotlin
View full sample
class CheckoutActivity : AppCompatActivity() { private lateinit var paymentIntentClientSecret: String override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // ... startCheckout() } private fun startCheckout() { // Request a PaymentIntent from your server and store its client secret in paymentIntentClientSecret // Click View full sample to see a complete implementation } }

Submit the payment to Stripe
Client-side

Retrieve the client secret from the SetupIntent you created and call PaymentLauncher confirm. This presents a webview where the customer can complete the setup on their bank’s website or app. Afterwards, onPaymentResult is called with the result of the payment.

Kotlin
class CheckoutActivity : AppCompatActivity() { // ... private lateinit var paymentIntentClientSecret: String private val paymentLauncher: PaymentLauncher by lazy { PaymentLauncher.Companion.create( this, PaymentConfiguration.getInstance(applicationContext).publishableKey, PaymentConfiguration.getInstance(applicationContext).stripeAccountId, ::onPaymentResult ) } private fun startCheckout() { // ... val confirmParams = ConfirmPaymentIntentParams .createWithPaymentMethodCreateParams( paymentMethodCreateParams = PaymentMethodCreateParams.createPayPal(), clientSecret = paymentIntentClientSecret ) paymentLauncher.confirm(confirmParams) } private fun onPaymentResult(paymentResult: PaymentResult) { val message = when (paymentResult) { is PaymentResult.Completed -> { "Completed!" } is PaymentResult.Canceled -> { "Canceled!" } is PaymentResult.Failed -> { // This string comes from the PaymentIntent's error message. // See here: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error-message "Failed: " + paymentResult.throwable.message } } } }

You can find the payment owner’s name, email, payer ID, and transaction ID in the payment_method_details property.

FieldValue
payer_emailThe email address of the payer on their PayPal account.
payer_nameThe name of the payer on their PayPal account.
payer_idA unique ID of the payer’s PayPal account.
transaction_idA unique transaction ID generated by PayPal.
{ "charges": { "data": [ { "payment_method_details": { "paypal": { "payer_id": "H54KFE9XXVVYJ", "payer_email": "jenny@example.com", "payer_name": "Jenny Rosen", "transaction_id": "89W40396MK104212M" }, "type": "paypal" }, "id": "src_16xhynE8WzK49JbAs9M21jaR", "object": "source", "amount": 1099, "client_secret": "src_client_secret_UfwvW2WHpZ0s3QEn9g5x7waU", "created": 1445277809, "currency": "eur", "flow": "redirect",

OptionalHandle post-payment events

Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc