Skip to main content
All throwing methods on 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:
After a charge fails, 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

One of these conditions occurred:
  • Your code called cancel() or stopped the Task that runs charge.
  • The seller closed the Tap to Pay screen of iOS.
  • The seller refused the Apple terms.
If the reader did not have the card, the SDK voided the payment. Usually, you show no message.
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.
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.
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.
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.
The reader lost its connection, or its session expired. The next charge connects again. Thus, let the seller try again.
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.
Tap to Pay on iPhone must have a device passcode. Tell the seller to add a passcode in Settings. Then try again.
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.
Apple or Whop does not let this account use Tap to Pay on this device. For example, Apple or Whop blocked the device or the account, or the reader setup failed. A new attempt does not help. Tell the seller to contact Whop support with underlyingCode.
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.
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.
Your token provider threw an error or returned an empty string. Or, the reader could not start its session with Whop. Examine your token endpoint. Then try again.
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 TapToPay instance charged the payment.
charge throws this error when the Whop payment does not wait for a card. message gives the cause.
Whop refused a request. underlyingCode is the HTTP status. message is the explanation from Whop.
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.