Skip to main content

Overview

Enable native Apple Pay onramp in your React Native app, allowing users to purchase crypto directly without leaving your app. This provides the fastest onramp experience available, with a fully native feel on iOS devices.
Native Apple Pay onramp is currently available for US users only on iOS devices via the React Native SDK. For web users, or to support other payment methods, see Cross-Platform Onramp.

Prerequisites

  • A free CDP Portal account and project
  • A React Native app using the CDP React Native SDK
  • iOS development environment (Xcode 16.1+, iOS 15.1+)
  • Users must be located in the United States with a valid US phone number

Testing and Production Access

You can get started testing the Apple Pay onramp using sandbox mode by setting isSandbox: true when creating orders. When you’re ready to test with real funds, contact us to get production access.

User Verification Requirements

Apple Pay onramp requires users to have verified contact information:
  • Email verification: Users must have a verified email address
  • SMS verification: Users must have a verified US phone number (a real mobile number, not VoIP).
CDP handles the verification process, but you are responsible for building the UI to prompt users when verification is needed. The useApplePay hook returns an error with a specific code when verification is required, allowing you to display the appropriate verification flow.

Integration

The React Native SDK provides three main components for Apple Pay integration:

Installation

Install the @coinbase/cdp-react-native package, along with its peer dependency on react-native-webview (tested on version 13.13.5):

Setup

Wrap your app or the relevant screen with the ApplePayProvider:

Using the useApplePay Hook

The useApplePay hook provides access to order creation and payment status:

Hook Return Values

The useApplePay hook returns the following:

CreateOrderOptions

Error Codes

When status is 'error', check the error.code to determine the appropriate action:

Rendering the Apple Pay Button

The ApplePayButton component automatically reads the payment URL from the ApplePayProvider context and renders the Apple Pay WebView. It only renders when order data is available:
The ApplePayButton returns null on non-iOS platforms. You should check Platform.OS === 'ios' and display an appropriate message for Android users.

Handling Verification

When the useApplePay hook returns an error indicating missing verification, guide users through the verification process. You can use the CDP hooks to handle email and SMS verification:
Here’s a complete example showing the full Apple Pay onramp flow with verification handling:
Your users must accept Coinbase’s legal agreements before using Apple Pay onramp: Ensure your app clearly informs users that by proceeding with payment, they are agreeing to these policies.

Reference Implementation

For a complete React Native reference implementation showcasing the Apple Pay integration with user wallets, check out the example app on GitHub.