TapToPay throw TapToPayError with Swift typed throws. Catch it with do throws(TapToPayError). Then you can read the code of the error without a cast:
TapToPay.lastError contains the same error until the next charge starts.
Error properties
message is in English. To show a different language to the seller, map code to your localized strings.Error codes
Error details
cancelled
cancelled
One of these conditions occurred:
- Your code called
cancel()or stopped theTaskthat runscharge. - The seller closed the Tap to Pay screen of iOS.
- The seller refused the Apple terms.
declined
declined
The card issuer or the reader declined the card.
paymentID identifies the payment. Ask the buyer for a different card. Then charge again. Each charge creates a new payment.outcomeUnknown
outcomeUnknown
The reader has the card, but the SDK could not confirm the result in the time limit. Usually, the cause is a network failure immediately after the tap. Whop possibly charged the buyer.Do not charge again before you know the result. Find the payment with
error.paymentID. Use Retrieve Payment from your server, or use the dashboard. If the payment is successful, the sale is complete. If it is not successful, charge again.For this failure only, the SDK does not void the payment, because Whop possibly charged the card.network
network
A request to Whop failed after the SDK tried it again. Or, Whop was busy with an earlier attempt of the same request. Examine the connection and try again. Whop possibly created a payment before the failure. In this condition, the SDK voids the payment at the start of the next charge, if the app still runs. Thus, a new attempt does not keep duplicate payments open.
busy
busy
Only one charge or
prepare() can run on a device at a time, for all TapToPay instances. If a charge starts while a different charge or a prepare() runs, it throws .busy. The running operation does not change. Disable your charge button while isBusy is true.notPrepared
notPrepared
The reader lost its connection, or its session expired. The next
charge connects again. Thus, let the seller try again.termsNotAccepted
termsNotAccepted
The seller must accept the Apple terms for Tap to Pay on iPhone one time on each device. For this, the seller must sign in to an Apple Account on the iPhone. iOS shows the terms on the first charge. If the seller did not sign in, or the terms do not open, the seller must sign in under Settings. Then try again.
passcodeRequired
passcodeRequired
Tap to Pay on iPhone must have a device passcode. Tell the seller to add a passcode in Settings. Then try again.
unsupportedDevice
unsupportedDevice
The device cannot use Tap to Pay, for example an older iPhone. Before you show a charge option, examine
isSupported. Then sellers do not get this error.readerIncompatible
readerIncompatible
Your app has a version of the SDK that Whop does not accept for this account. Or, the versions of the two SDK packages in your app are different. Update the
WhopTTP package. Then release a new build. Refer to Troubleshooting.invalidCredentials
invalidCredentials
Whop rejected the token, also after the SDK got a new token. Usually, the cause is a token from the other environment, for example a sandbox token in a
.production TapToPay. Make sure that your server uses the API key for the same environment. Refer to Authentication.invalidPayment
invalidPayment
The call is not correct for the payment.
attachBuyer throws this error in these conditions:- The payment has a buyer.
- You charged the payment with an email.
- A different
TapToPayinstance charged the payment.
charge throws this error when the Whop payment does not wait for a card. message gives the cause.requestFailed
requestFailed
Whop refused a request.
underlyingCode is the HTTP status. message is the explanation from Whop.unknown
unknown
The SDK could not identify the type of this error. Show
message. Record underlyingCode. Let the seller try one more time. If the error occurs again, contact Whop support.Next steps
Troubleshooting
Solutions for setup problems, and answers to frequent questions.
SDK reference
All public types and members.

