Open Paddle Checkout from iOS apps

Get a step-by-step guide on how to implement Paddle Checkout as an external payment flow for your iOS app, letting you go direct to customers while remaining compliant.

With recent developments in legislation around the App Store, you can direct users in the United States to an external checkout for purchases in iOS apps.

You can use Paddle Checkout to quickly and securely collect for payment for digital products. It presents customers with a secure, optimized payment workflow that handles all parts of the checkout process — minimal frontend coding required.

We're working on a starter kit that you can use to deploy a checkout for iOS apps in a couple of clicks. If you'd like to be the first to get access, join the waitlist.

What are we building?

In this tutorial, we'll create a payment flow that lets your iOS app users make purchases through Paddle Checkout.

Mobile checkout screen for a lifestyle app. The left side shows a payment page with a blue running shoe logo, price of $250.00 including tax, collapsed order summary section, and payment options including Apple Pay button, Card option (selected), and PayPal option. Card number field shows placeholder text with accepted payment logos (Mastercard, Visa, American Express, and Diners Club). The right side shows a confirmation screen with a blue checkmark icon and text 'Your transaction has been completed successfully.'

What's included with Paddle

With Paddle Checkout, you get:

What's not covered

This tutorial walks you through launching Paddle Checkout from an iOS app. It doesn't cover:

  • Handling authentication

    We assume you already have a way to identify your users, like Firebase or Sign in with Apple.

  • Native in-app purchases

    We'll launch Paddle Checkout in Safari then redirect users back to your app. Paddle Checkout supports Apple Pay with no additional setup, along with PayPal, Google Pay, and other popular payment options.

  • Subscription lifecycle management

    You can use Paddle to handle all parts of the subscription lifecycle, including updating payment methods and canceling subscriptions using the prebuilt customer portal. We cover that elsewhere in our docs.

Overview

Implement a payment workflow for your iOS app in six steps:

  1. Map your product catalog

    Create products and prices in Paddle that match your in-app purchase options.

  2. Add Paddle.js to your website

    Include Paddle.js on a page on your website, then handle the post-purchase redirect back to your app.

  3. Create a transaction in Paddle

    Build logic in your backend to create a customer and a transaction in Paddle, ready for checkout.

  4. Launch a checkout from your iOS app

    Add a button to your app that creates a transaction in Paddle and opens Paddle Checkout in Safari.

  5. Handle fulfillment and provisioning using webhooks

    Process webhooks to fulfill purchases after a customer completes a checkout.

  6. Take a test payment

    Verify your payment flow works correctly using test card details.

1. Map your product catalog

Before we implement Paddle Checkout, we need to set up our product catalog in Paddle to match the in-app purchases offered in-app.

Model your pricing

A complete product in Paddle is made up of two parts:

  • A product entity that describes the item, like its name, description, and an image.
  • At least one related price entity that describes how much and how often a product is billed.

You can create as many prices for a product as you want to describe all the ways they're billed.

In this example, we'll create a single product and single price for a one-time item called Lifetime Access.

Create products and prices

You can create products and prices using the Paddle dashboard or the API.

  1. Go to Paddle > Catalog > Products.

  2. Click New product.

  3. Enter details for your new product, then click Save when you're done.

  4. Under the Prices section on the page for your product, click New price.

  5. Enter details for your new price. Set the type to One-time to create a one-time price.

  6. Click Save when you're done.

Illustration showing the new product drawer in Paddle. It shows fields for product name, tax category, and description

2. Add Paddle.js to your website

Paddle.js is a lightweight JavaScript library that lets you build rich, integrated billing experiences using Paddle. We can use Paddle.js to securely open a checkout, capture payment information, and launch our success workflow.

When you add Paddle.js to a page, you can redirect to that page and append a _ptxn query parameter with the value of a transaction ID in Paddle to launch a checkout automatically.

You can create a new page, or add to an existing one like your homepage.

Include and initialize Paddle.js

You can install and import Paddle.js using a JavaScript package manager.

  1. Install Paddle.js using npm, yarn, or pnpm.

  2. Import Paddle.js, then initialize by calling the initializePaddle() function with a configuration object.

     

    We'll get a client-side token in the next step.

Get a client-side token

Client-side tokens are for authenticating with Paddle in your frontend. We need one to securely open Paddle Checkout.

  1. Go Paddle > Developer tools > Authentication

  2. Click the Client-side tokens tab, then click New client-side token.

  3. Give your client-side token a name and description, then click Save.

  4. From the list of client-side tokens, click the action menu next to the client-side token you just created, then choose Copy token from the menu.

  5. Paste your token as CLIENT_SIDE_TOKEN in the code you copied.

Paddle's Authentication dashboard interface showing API management tools. The page header 'Authentication' appears at top left with a 'New client-side token' button at top right. Below is explanatory text: 'Securely manage your secret API keys and client-side tokens. Use API keys to interact with Paddle on the server side, or when working with trusted integrations. Use client-side tokens for working with Paddle.js in your frontend.' Navigation tabs show 'API keys' and 'Client-side tokens' (selected). A table displays existing keys with columns for Name, Token (showing masked values like 'live_******'), Status (showing 'Active' with green indicators), and Last used dates from September 20.

Build a success workflow

After users complete a purchase successfully, we need to bounce users back to our app.

To do this, we can use an event callback function. Paddle.js emits events throughout the checkout process when key things happen. An event callback function is some code that we run when a specific event occurs.

In our case, when Paddle.js emits a checkout.completed event, we're going to redirect to a screen in our app.

Import Paddle.js events, then update your Paddle configuration object to include an eventCallback:

Replace myapp://example-redirect with a universal link in your iOS app, but keep the ?transactionId=${event.data?.id} part. This is important as it gives us reference for the checkout in our app.

When you're done, deploy your page to your website.

Set your default payment link

Your default payment link is a quick way to open Paddle Checkout for a transaction. It's also used in emails from Paddle that let customers manage purchases that are recurring. You need to set a default payment link before you can launch a checkout.

We'll set our default payment link to the page where we just added Paddle.js:

  1. Go to Paddle > Checkout > Checkout settings.

  2. Enter the page where you added Paddle.js under the Default payment link heading.

  3. Click Save when you're done.

Checkout settings screen showing the Paddle dashboard. The default payment URL is set to https://example.com/

3. Create a transaction in Paddle

Transactions are the central billing entity in Paddle. They capture and calculate revenue for a customer purchase, and represent what they see when they open a checkout.

We'll create a transaction with details about what our customer is purchasing in our backend, then extract the checkout link to launch a checkout. We can use the transaction ID to match with a completed purchase later.

Install Paddle

First, add the Paddle SDK to your backend. Paddle has SDKs for Node.js, Python, PHP, and Go.

Install using npm, yarn, or pnpm. For example:

Get an API key

API keys are for authenticating with Paddle in your backend. We need one to create a transaction.

  1. Go Paddle > Developer tools > Authentication

  2. Click the New API key button.

  3. Give your key a name and description, then set an expiry date.

  4. Under permissions, check Write for customers and transactions. You can always edit permissions later.

  5. Click Save when you're done, then copy the API key.

  6. Store this safely in your credential manager or secret store.

A modal dialog window titled 'New API key' with form fields for creating a Paddle API key. Contains input fields for 'Name' (required) and 'Description' (optional). The 'Expires' section shows default expiration set to '90 days (March 8, 2025)' with a calendar picker and explanatory text about setting expiration dates for security and compliance with a 'Learn more' link. A close button appears in the top-right corner. In the background, a partially visible table shows previously created API keys.

Treat your API key like a password. Keep it safe and never share it with apps or people you don't trust.

Set up the endpoint

You need to set up an endpoint to call from your iOS app to create the transaction in Paddle and return the checkout URL.

Create a customer

If your user is signed in to your app, create a customer in Paddle for them.

Customers are lightweight entities that hold high-level details, like name and email address. They have related address and business entities.

We recommend storing the customer ID against your authentication provider, so you can associate the customer with their purchases in Paddle.

Create a transaction and extract the URL

To set up a checkout, create a transaction with:

  • The customer ID of this customer.
  • The items the customer is purchasing, which include the price ID we set up earlier and a quantity for each.

Once created, extract the checkout.url and return it to your app.

If you've integrated with RevenueCat for order fulfilment, include an object of custom data containing a unique identifier for RevenueCat.

4. Launch a checkout

Update your iOS app to add a button that:

  1. Checks to see if in-app purchases are allowed on the device

  2. Checks to see if a user already purchased the item.

  3. Calls your backend endpoint to create a Paddle transaction.

  4. Opens the URL returned by your endpoint in Safari.

  5. Listens for when the app is reopened via URL scheme after the checkout is completed.

  6. Extracts the transaction ID from the redirect URL query parameter.

  7. Updates the UI and enters into your order fulfilment workflow.

Mobile app screen with light blue background showing a running show icon in a circular light blue container. Text reads 'Unlock lifetime access' Below is a prominent blue button with white text saying 'Buy now for $250.00'.

Mobile app screen showing a success message with a mint green circular icon containing a yellow unlocked padlock. Text reads 'Lifetime access unlocked. Enjoy!' Below is a bright green button with white text saying 'Start now'.

Remember to register a custom URL scheme for your redirect in your Info.plist file if you haven't already.

5. Handle fulfillment and provisioning

If you use the RevenueCat x Paddle integration to handle entitlements, you're all set!

Here's how it works:

  1. Paddle automatically sends data to RevenueCat about the completed checkout.

  2. RevenueCat grants the user an entitlement based on your product configuration.

  3. Use the RevenueCat SDK to check entitlement status in your iOS app.

Illustration of the new destination drawer in Paddle. It shows fields for description, type, URL, and version. Under those fields, there's a section called events with a checkbox that says 'select all events'

6. Take a test payment

We're now ready to test! If you're using a sandbox account, you can take a test payment using our test card details:

Email addressAn email address you own
CountryAny valid country supported by Paddle
ZIP code (if required)Any valid ZIP or postal code
Card number4242 4242 4242 4242
Name on cardAny name
Expiration dateAny valid date in the future.
Security code100

Next steps

That's it. Now you've built a checkout flow using Paddle Billing, you might like to hook into other features of the Paddle platform.

Learn more about Paddle

When you use Paddle, we take care of payments, tax, subscriptions, and metrics with one unified platform. Customers can self-serve with the portal, and Paddle handles any order inquiries for you.

Build a web checkout

Our tutorial creates a transaction, then passes that transaction to Paddle.js. You can also use Paddle.js to build pricing pages and signup flows on the web, then redirect people to your app.

Build advanced subscription functionality

Paddle Billing is designed for subscriptions as well as one-time items. You can use Paddle to build workflows to pause and resume subscriptions, flexibly change billing dates, and offer trials.

OSZAR »