Skip to main content

Stripe Payments

Stripe lets you accept payments in your iOS app. Process one-time purchases, set up subscriptions, and manage customers.
Payment integration is complex and has legal/financial implications. Test thoroughly before going live. Consider consulting with a developer or accountant.

What You Can Build

  • One-time Payments — Single purchases
  • Subscriptions — Recurring billing
  • In-App Purchases — Digital content
  • Marketplace — Split payments

Prerequisites

  • Stripe account (free to create)
  • Apple Developer account (for real device testing)
  • Understanding of your pricing model

Important Considerations

Apple’s Rules

For digital goods and services (like app features or subscriptions), Apple requires you to use In-App Purchases, not Stripe directly. Use Stripe for:
  • Physical goods
  • Services delivered outside the app
  • Business-to-business transactions
Use Apple In-App Purchase for:
  • Premium app features
  • Digital subscriptions
  • Virtual currency/items

PCI Compliance

Stripe handles credit card data, so you stay PCI compliant. Never store card numbers in your app.

Setting Up Stripe

1

Create Stripe account

Go to stripe.com and sign up
2

Get API keys

Dashboard → Developers → API keys
  • Use Test mode keys during development
  • Switch to Live mode keys for production
3

Configure in Nativeline


Test vs Live Mode

Test Mode

  • Use pk_test_ and sk_test_ keys
  • Use test card numbers
  • No real money processed
  • Perfect for development

Test Card Numbers

Live Mode

  • Use pk_live_ and sk_live_ keys
  • Real money processed
  • Only after thorough testing

Basic Payment Flow

Collect Payment

Using Stripe Payment Sheet

The easiest integration uses Stripe’s pre-built UI:

Implementation Approaches

Client-Side Only (Simple)

For simple use cases:
  1. Create PaymentIntent on Stripe dashboard
  2. Confirm payment from app
Limitation: Less secure, limited functionality More secure and flexible:
  1. Your server creates PaymentIntent
  2. App receives client secret
  3. App confirms payment
  4. Server receives webhook confirmation
Server-side component typically requires additional development beyond Nativeline. Consider services like Firebase Functions or Supabase Edge Functions.

Common Scenarios

Single Purchase

Subscription

Tipping / Variable Amount


Apple Pay

Stripe supports Apple Pay for faster checkout:
Requirements:
  • Apple Developer account
  • Merchant ID configured in Stripe
  • Device with Apple Pay capability

Webhooks

For reliable payment confirmation, use webhooks:
  1. Stripe sends event to your server
  2. Server updates your database
  3. App reflects the change

Security Best Practices

Stripe handles all card data. Your app never sees the actual card number.
Don’t trust client-side confirmations alone. Use webhooks to verify.
Always develop with test keys. Only switch to live for production.
Users can modify client code. Always verify amounts on your server.

Error Handling

Common Errors

Handling in App


Refunds

Process refunds from Stripe Dashboard:
  1. Payments → Find payment
  2. Click “Refund”
  3. Full or partial refund
For automated refunds, use Stripe API from your server.

Testing Checklist

Before going live:
  • Successful payment completes
  • Declined card shows error
  • Network failure handled
  • Loading states shown
  • Confirmation displayed
  • Purchase recorded in database
  • Refund process works
  • Subscription renewal works
  • Cancellation handled

Going Live

1

Complete Stripe account setup

Add business details, bank account for payouts
2

Test thoroughly in test mode

Cover all scenarios
3

Switch to live keys

Update API keys in your app/server
4

Process a real test payment

Use your own card for a small amount
5

Refund the test payment

Verify refund works
6

Monitor closely after launch

Watch Stripe dashboard for issues

Next Steps

Maps & Location

Add mapping features

Other APIs

Generic API guide