Prerequisites
- The user has completed onboarding.
- The
apple-pay-withdrawalscapability is enabled. - A funded account to debit the funds from.
- The Payment Widget is set up in your frontend and Apple Pay’s additional setup requirements are met. See Installation and setup.
Walkthrough
The diagram shows an Apple Pay transaction authorization.Check available rails
Call List rails to verify Apple Pay withdrawal is available.Check capabilities
Call List capabilities to confirm the user has theapple-pay-withdrawals capability enabled with no unmet requirements.
Select source account
withdrawals can be sourced from any account. If the selected account is not in the account’s currency, the balance will be converted at the time of the transaction using Uphold’s prevailing rate. Make sure the origin asset has the necessary features enabled. Call List accounts to retrieve the user’s accounts and let them pick the one to withdraw from.Create a quote
Call Create quote with the user’s account as the origin and Apple Pay as the destination. Specify Apple Pay as the destination withtype: "apm" with method: "apple-pay".
requirements array. For Apple Pay, it contains authorize:apple-pay, which indicates that the user must authorize Apple Pay before the transaction can be created.
Present the order summary
Before creating the transaction, display an order summary of the quote — the amount, fees, and the origin and destination — so the user can review it. Here’s an example:
Authorize and create the transaction
After the user confirms the Apple Pay quote, hand off to the Payment Widget Authorize flow. It presents the Apple Pay sheet, creates the transaction, and polls until a terminal status is reached. Apple Pay authorizes per transaction on the user’s device — there is no stored authorization to reuse, so the user confirms with Face ID, Touch ID, or their passcode every time. By default, the widget renders a full walkthrough around the authorization; in headless mode, it renders only the Apple Pay button so you can embed it directly into your own UI — see Headless mode below.Create an authorize session
Call Create widget session withflow: "authorize", the quoteId and with the requirements array containing authorize:apple-pay. For web apps, also include the top-page domain.
The top-page domain is the domain shown in the browser’s URL bar — the very top-level page hosting the widget iframe. For web apps, it must match the domain you registered with Apple Pay for your merchant ID.
Set up the widget
Initialize the widget with the session. The widget presents the Apple Pay sheet, collects device data, creates the transaction, and polls until a terminal status is reached.Both examples above are for web applications — either creating the iframe yourself or letting the SDK do it. For native apps using a WebView, see Native apps with the SDK for the SDK’s native-bundling pattern, or Setup with JavaScript for the no-SDK approach that loads the session
url directly as the WebView’s top-level page.Headless mode
By default, the widget renders a full authorization experience — a short walkthrough, the Apple Pay button, and a processing screen while the transaction is confirmed. In headless mode, it renders only the Apple Pay button, with no surrounding UI, so you can embed it directly into your own layout. Your app then owns the surrounding context and the post-authorization experience — progress and success feedback, and a way to cancel.AuthorizeFlowOptions in the SDK reference for the full type definition.
Handle the complete event
transaction.statusDetails.reason:
Handle cancellations
Thecancel event fires when the user dismisses the Apple Pay sheet or navigates back without completing authorization.
Handle errors
Theerror event fires for critical unrecoverable errors — except authorize_transaction_failed, which is retryable. It is your decision whether to unmount the widget and show a user-facing error message, or leave it mounted so the user can try again.
event.detail.error.code:
Monitor for settlement
transactions remain inprocessing while the payment settles. Monitor until the transaction reaches a terminal state.
- Webhook events (recommended):
- core.transaction.created —
status: processing→ transaction created, pending settlement - core.transaction.status-changed —
status: completed→ funds settled;status: failed→ irrecoverable error
- core.transaction.created —
- Polling (fallback): Get transaction
Sample transaction
In a successful Apple Pay withdrawal, the origin is the user’saccount and the destination is an apm node with the method as apple-pay. The transaction status is initially processing and updates to completed once the transfer settles.
Notify the user
After the transaction completes, display the transaction details to the user so they can confirm the withdrawal succeeded. Here’s an example:
Troubleshooting
Having issues rendering Apple Pay? See Troubleshooting in the Payment Widget installation guide.You now support Apple Pay withdrawals via the REST API together with the Payment Widget.