This page documents
WhopTTP 1.0.0 for iOS.WhopTTP Swift package. You use one TapToPay object and one charge call.
This page shows how to do a first charge. The pages at the end of this page give all other data. For example, they include onboarding and errors.
Install
Add the package to yourPackage.swift file. You can also select File → Add Package Dependencies in Xcode and enter the URL:
Package.swift
WhopTTP product to your app target. Then add import WhopTTP to your code.
Requirements
Before you start
You must have three items.1
The Tap to Pay on iPhone entitlement
The Account Holder of your Apple Developer account requests it from Apple. Request the entitlement shows each step of the form. After Apple gives you the entitlement, add the capability to the entitlements file of your app target:
YourApp.entitlements
2
Two Info.plist keys
If one of these keys is not there, the app stops at the first charge:The Bluetooth background mode is not necessary. Before the first charge, ask for When In Use location permission. The full example shows how to do this.
Info.plist
3
A server endpoint that creates an access token
The SDK uses a short-lived access token. Your server creates this token for the account of the seller, with the Your app gives the
payment:charge and payment:basic:read scopes:token from the response to the SDK. Authentication has server code in TypeScript, Python, and cURL.Take your first payment
TapToPay is a main-actor, @Observable object for the account of one seller. Create it with the account ID and a closure that gets a token from your server. Then call charge:
CheckoutView.swift
YourServer.tapToPayToken() is an example name for your call to the token endpoint. It returns the token string.
Run the code on an iPhone. The first charge connects the reader. Thus, the first charge is some seconds slower than the charges after it. On the first charge on a device, iOS also tells the seller to accept the Apple terms for Tap to Pay on iPhone. If the payment is successful, charge returns a TapToPayPayment. Its id is the Whop payment ID (pay_…).
In your production app, call
prepare() when the app starts. Also call it when the app comes back to the foreground. It connects the reader before the first sale. It also shows the Apple terms at that time, not when a buyer is there. Refer to Prepare the reader.What’s next
Authentication
Create tokens on your server. Select production or sandbox.
Accept payments
Charge a variant or a custom amount. Add metadata and send receipts.
Build the payment screen
Use
phase, isBusy, and isSupported to control your UI. Let sellers cancel a charge.Onboard accounts
Make sure that an account can use Tap to Pay. Then activate it.
Handle errors
All
TapToPayError codes and the message to show the seller.Go live
The checklist to complete before you send your app to the App Store.

