strip

1. Add Stripe Dependency

In app/build.gradle:

2. XML Layout

activity_payment.xml

3. Initialize Stripe

In Application class or your Activity:

4. Java Activity Example

5. Backend (Required)

Create a PaymentIntent on your server:

Example (Node.js):

6. Confirm Payment on Android

After receiving the client_secret from your backend:

Quick Setup Steps

  1. Create a Stripe account at Stripe Dashboard
  2. Get your Publishable Key and Secret Key.
  3. Add the Stripe Android SDK.
  4. Create a backend endpoint that generates a PaymentIntent.
  5. Send the PaymentIntent client_secret to Android.
  6. Call confirmPayment().
  7. Handle success/failure callbacks.

Modern Alternative

Stripe now recommends using the PaymentSheet UI, which requires much less code and supports cards, Apple Pay/Google Pay (where applicable), and other payment methods automatically.