> ## Documentation Index
> Fetch the complete documentation index at: https://developer.uphold.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Apple Pay withdrawal via the Payment Widget

> Build a hybrid Apple Pay withdrawal flow: the Payment Widget handles Apple Pay selection and authorization, while your app builds the amount and review screens and creates the quote.

The Payment Widget handles Apple Pay selection for withdrawals via the `transaction:select-withdrawal-destination` flow, where users can select Apple Pay directly in the widget. After the user confirms an Apple Pay withdrawal quote, the Payment Widget creates the transaction and completes the Apple Pay authorization via the `transaction:authorize` flow.

> [!NOTE]
>
> The transaction flows were renamed to the `<context>:<action>` format. The previous names still work, as aliases with the same behavior and `complete` payload, but they are **deprecated** and will be removed in a future release:
>
> | Deprecated name | New name |
> | - | - |
> | `select-for-deposit` | `transaction:select-deposit-origin` |
> | `select-for-withdrawal` | `transaction:select-withdrawal-destination` |
> | `authorize` | `transaction:authorize` |
>
> To migrate, change the `flow` of the Create session request and, with the Web SDK, the `PaymentWidget` generic type. See [Flows](https://developer.uphold.com/widgets/payment/flows.md#deprecated-flow-names).

> [!NOTE]
>
> This guide uses the select flows, where your app builds the amount entry and review screens and handles errors. For a single-session experience where the widget handles the amount, quote and errors, see [End-to-end](https://developer.uphold.com/developer-guides/apm-transfers/withdrawal/via-payment-widget/end-to-end.md). To compare all flows, see [Flows](https://developer.uphold.com/widgets/payment/flows.md).

## Prerequisites

* The user has [completed onboarding](https://developer.uphold.com/developer-guides/user-onboarding/introduction.md).
* The `apple-pay-withdrawals` capability is enabled.
* A **funded account** to debit the funds from.
* The Payment Widget is [set up in your frontend](https://developer.uphold.com/widgets/payment/installation-and-setup.md).
* [Apple Pay's additional setup requirements](https://developer.uphold.com/developer-guides/apm-transfers/introduction.md#apple-pay) are met.
* The target browser or platform [supports Apple Pay](https://developer.uphold.com/developer-guides/apm-transfers/introduction.md#browser-and-platform-compatibility-payment-widget).

## Walkthrough

```mermaid theme={null}
sequenceDiagram
  autonumber
  participant Usr as User
  participant U as Your App
  participant B as Your Backend
  participant P as Payment Widget
  participant A as Uphold

  Usr->>U: Start withdrawal
  U->>B: List accounts
  B->>A: GET /core/accounts
  A-->>B: { accounts }
  B-->>U: { accounts }
  Usr->>U: Choose source account
  U->>B: Create widget session
  B->>A: Create widget session (transaction:select-withdrawal-destination)
  A-->>B: { session }
  B-->>U: { session }
  U->>P: Initialize widget
  Usr->>P: Select Apple Pay
  P-->>U: complete { via, selection }
  Usr->>U: Choose amount
  U->>B: Create quote
  B->>A: Create quote (account → APM)
  A-->>B: { quote }
  B-->>U: { quote }
  U->>B: Create authorize session
  B->>A: Create widget session (transaction:authorize)
  A-->>B: { session }
  B-->>U: { session }
  U->>P: Initialize widget
  Usr->>P: Authorize with Apple Pay sheet
  P->>A: Create transaction
  A-->>P: { transaction }
  P-->>U: complete { transaction, trigger }
  B-->>Usr: Notify the user
```

***

## Select source account

Apple Pay withdrawals can be sourced from any account. If the selected account is not in the Apple Pay 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](https://developer.uphold.com/rest-apis/core-api/assets/overview.md#features-and-deposits-/-withdrawals).

Call [List accounts](https://developer.uphold.com/rest-apis/core-api/accounts/list-accounts.md) to retrieve the user's accounts and let them pick the one to withdraw from.

```http theme={null}
GET /core/accounts
```

```json theme={null}
{
  "accounts": [
    {
      "id": "a00507fe-628c-4f27-ae81-e1c40b2a8fb8",
      "ownerId": "e4ce04dc-67b7-4e9f-af91-482cb6f9fc4a",
      "label": "My USD account",
      "asset": "USD",
      "balance": {
        "total": "500.00",
        "available": "500.00"
      },
      "createdAt": "2026-06-01T12:00:00Z",
      "updatedAt": "2026-06-01T12:00:00Z"
    }
  ]
}
```

***

## Select withdrawal method

The Payment Widget's `transaction:select-withdrawal-destination` flow presents the available payment methods, letting the user select Apple Pay when it's available. It performs **selection only**: it does not create the quote or the transaction.

### Create a widget session

Call [Create widget session](https://developer.uphold.com/rest-apis/widgets-api/payment/create-session.md) to start the `transaction:select-withdrawal-destination` flow. To customize the theme and layout, see [Create a session](https://developer.uphold.com/widgets/payment/installation-and-setup.md#1-create-a-session-on-your-backend).

```http theme={null}
POST /widgets/payment/sessions
{
  "flow": "transaction:select-withdrawal-destination"
}
```

The response contains a `session` object with a `url` field that loads the widget. Return `response.session` to your frontend as is.

```jsonc theme={null}
{
  "session": {
    "url": "https://payment-widget.enterprise.uphold.com/?sessionToken=..."
    // ...
  }
}
```

### Set up the widget

```typescript Web SDK [expandable] theme={null}
import { PaymentWidget } from '@uphold/enterprise-payment-widget-web-sdk';

// session is `response.session` from your backend
const initializeWithdrawalWidget = async (session) => {
  const widget = new PaymentWidget<'transaction:select-withdrawal-destination'>(session, { debug: true });

  widget.on('complete', (event) => {
    console.log('Complete', JSON.stringify(event.detail.value));
    widget.unmount();
  });

  widget.on('cancel', () => {
    console.log('Cancelled');
    widget.unmount();
  });

  widget.on('error', (event) => {
    console.error('Error', event.detail.error);
    widget.unmount();
  });

  widget.mountIframe(document.getElementById('payment-container'));
};
```

```html Without SDK [expandable] theme={null}
<div id="payment-container"></div>

<script>
  // session is `response.session` from your backend
  async function initializeWithdrawalWidget(session) {
    const container = document.getElementById('payment-container');
    const sessionOrigin = new URL(session.url).origin;

    const iframe = document.createElement('iframe');
    iframe.src = session.url;
    iframe.setAttribute('allow', "clipboard-write 'src'; clipboard-read 'src'; payment 'src';");
    iframe.style.width = '100%';
    iframe.style.height = '100%';
    iframe.style.border = 'none';

    function teardown() {
      window.removeEventListener('message', onMessage);
      iframe.remove();
    }

    function onMessage(event) {
      if (event.origin !== sessionOrigin) return;

      switch (event.data?.type) {
        case 'load':
          // Optional: repeat theme or layout from Create session to avoid a brief flash of defaults
          iframe.contentWindow.postMessage({ options: {}, type: 'init' }, sessionOrigin);
          break;
        case 'ready':
          break;
        case 'complete':
          console.log('Complete', JSON.stringify(event.data.value));
          teardown();
          break;
        case 'cancel':
          console.log('Cancelled');
          teardown();
          break;
        case 'error':
          console.error('Error', event.data.error);
          teardown();
          break;
      }
    }

    window.addEventListener('message', onMessage);
    container.appendChild(iframe);
  }
</script>
```

> [!NOTE]
>
> 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 Web SDK](https://developer.uphold.com/widgets/payment/installation-and-setup.md#native-apps-with-the-web-sdk) for the SDK's native-bundling pattern, or [Setup without the SDK](https://developer.uphold.com/widgets/payment/installation-and-setup.md#setup-without-the-sdk) for the no-SDK approach that loads the session `url` directly as the WebView's top-level page.

### Handle the complete event

The `complete` event fires after the user selects Apple Pay.

```javascript Web SDK theme={null}
widget.on('complete', (event) => {
  const { via, selection } = event.detail.value;

  // If via is 'apm', you can check the selected method through the property `selection.method`, which will be 'apple-pay' in this case.
  if (via === 'apm' && selection.method === 'apple-pay') {
    handleApplePaySelected();
  }

  widget.unmount();
});
```

```javascript Without SDK theme={null}
// Inside the onMessage switch from Set up the widget
case 'complete': {
  const { via, selection } = event.data.value;

  // If via is 'apm', you can check the selected method through the property `selection.method`, which will be 'apple-pay' in this case.
  if (via === 'apm' && selection.method === 'apple-pay') {
    handleApplePaySelected();
  }

  teardown();
  break;
}
```

Once you have the selection, proceed to [Create a quote](#create-a-quote).

### Handle cancellations

```javascript Web SDK theme={null}
widget.on('cancel', () => {
  widget.unmount();
  // Return the user to the previous screen
});
```

```javascript Without SDK theme={null}
// Inside the onMessage switch from Set up the widget
case 'cancel':
  teardown();
  // Return the user to the previous screen
  break;
```

### Handle errors

The `error` event fires for critical unrecoverable errors.

```javascript Web SDK theme={null}
widget.on('error', (event) => {
  console.error('Widget error:', event.detail.error);
  widget.unmount();
  // Show a user-friendly error message
});
```

```javascript Without SDK theme={null}
// Inside the onMessage switch from Set up the widget
case 'error':
  console.error('Widget error:', event.data.error);
  teardown();
  // Show a user-friendly error message
  break;
```

> [!WARNING]
>
> The Payment Widget handles most errors internally. For unrecoverable errors, the widget fires an `error` event. It is the host application's responsibility to handle these events, present an error message to the user, and unmount the widget.

***

## Create a quote

Call [Create quote](https://developer.uphold.com/rest-apis/core-api/transactions/create-quote.md) with the user's account as the origin and Apple Pay as the destination.

Specify Apple Pay as the destination with `type: "apm"` and `method: "apple-pay"`.

```http theme={null}
POST /core/transactions/quote
{
  "origin": {
    "type": "account",
    "id": "b8618cd1-ccb0-4a72-985f-3bb0d268dabd"
  },
  "destination": {
    "type": "apm",
    "method": "apple-pay"
  },
  "denomination": {
    "asset": "USD",
    "amount": "15",
    "target": "origin"
  }
}
```

A successful response includes the quote details and a `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.

```json [expandable] theme={null}
{
  "quote": {
    "id": "c3e8d2f7-9a41-4b75-b8e3-1d6f4a9c2e57",
    "origin": {
      "amount": "15.00",
      "asset": "USD",
      "node": {
        "type": "account",
        "id": "b8618cd1-ccb0-4a72-985f-3bb0d268dabd",
        "ownerId": "48e40cb2-6c34-44ce-b2f1-6adac459bb37"
      },
      "rate": "1"
    },
    "destination": {
      "amount": "15.00",
      "asset": "USD",
      "node": {
        "type": "apm",
        "method": "apple-pay"
      },
      "rate": "1"
    },
    "denomination": {
      "asset": "USD",
      "amount": "15.00",
      "target": "origin",
      "rate": "1"
    },
    "fees": [],
    "requirements": [
      "authorize:apple-pay"
    ],
    "refreshAt": "2025-06-18T01:55:39Z",
    "expiresAt": "2025-06-18T01:55:39Z"
  }
}
```

***

## Authorize and create the transaction

After the user confirms the Apple Pay quote, hand off to the Payment Widget's `transaction: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](#headless-mode) below.

### Create an authorize session

Call [Create widget session](https://developer.uphold.com/rest-apis/widgets-api/payment/create-session.md) to start the `transaction:authorize` flow, passing the `quoteId` and adding `authorize:apple-pay` to the `requirements` array. For web apps, also include the top-page `domain`. To enable [headless mode](#headless-mode), set `authorize.mode` to `headless` in `options`. To customize the theme and layout, see [Create a session](https://developer.uphold.com/widgets/payment/installation-and-setup.md#1-create-a-session-on-your-backend).

> [!NOTE]
>
> 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.
>
> This applies to the `transaction:authorize` flow. In the end-to-end `transaction:deposit-e2e` and `transaction:withdrawal-e2e` flows, the Widget creates the `transaction:authorize` session and determines the top-level page domain itself, so you don't pass a `domain`.

```http theme={null}
POST /widgets/payment/sessions
{
  "flow": "transaction:authorize",
  "data": {
    "quoteId": "<quoteId>",
    "requirements": [
      "authorize:apple-pay"
    ],
    "domain": "<top-page-domain>" // For web apps only, required for Apple Pay
  }
}
```

The response contains a `session` object with a `url` field that loads the widget. Return `response.session` to your frontend as is.

```jsonc theme={null}
{
  "session": {
    "url": "https://payment-widget.enterprise.uphold.com/?sessionToken=..."
    // ...
  }
}
```

### 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.

```typescript Web SDK [expandable] theme={null}
import { PaymentWidget } from '@uphold/enterprise-payment-widget-web-sdk';

// session is `response.session` from your backend
const initializeAuthorizeWidget = async (session) => {
  const widget = new PaymentWidget<'transaction:authorize'>(session, { debug: true });

  widget.on('complete', (event) => {
    const { transaction, trigger } = event.detail.value;
    console.log('Complete', transaction.status, trigger.reason);
    widget.unmount();
  });

  widget.on('cancel', () => {
    console.log('Cancelled');
    widget.unmount();
  });

  widget.on('error', (event) => {
    console.error('Error', event.detail.error);
    widget.unmount();
  });

  widget.mountIframe(document.getElementById('payment-container'));
};
```

```javascript Without SDK [expandable] theme={null}
// session is `response.session` from your backend
async function initializeAuthorizeWidget(session) {
  const container = document.getElementById('payment-container');
  const sessionOrigin = new URL(session.url).origin;

  const iframe = document.createElement('iframe');
  iframe.src = session.url;
  iframe.setAttribute('allow', "clipboard-write 'src'; clipboard-read 'src'; payment 'src';");
  iframe.style.width = '100%';
  iframe.style.height = '100%';
  iframe.style.border = 'none';

  function teardown() {
    window.removeEventListener('message', onMessage);
    iframe.remove();
  }

  function onMessage(event) {
    if (event.origin !== sessionOrigin) return;

    switch (event.data?.type) {
      case 'load':
        // Optional: repeat theme, layout, or authorize.mode from Create session to avoid a brief flash of defaults
        iframe.contentWindow.postMessage({ options: {}, type: 'init' }, sessionOrigin);
        break;
      case 'complete': {
        const { transaction, trigger } = event.data.value;
        console.log('Complete', transaction.status, trigger.reason);
        teardown();
        break;
      }
      case 'cancel':
        console.log('Cancelled');
        teardown();
        break;
      case 'error':
        console.error('Error', event.data.error);
        teardown();
        break;
    }
  }

  window.addEventListener('message', onMessage);
  container.appendChild(iframe);
}
```

> [!NOTE]
>
> 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 Web SDK](https://developer.uphold.com/widgets/payment/installation-and-setup.md#native-apps-with-the-web-sdk) for the SDK's native-bundling pattern, or [Setup without the SDK](https://developer.uphold.com/widgets/payment/installation-and-setup.md#setup-without-the-sdk) 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.&#x20;

To enable it, set `authorize.mode` to `headless` in the `options` of the [Create widget session](https://developer.uphold.com/rest-apis/widgets-api/payment/create-session.md) request:

```http theme={null}
POST /widgets/payment/sessions
{
  "flow": "transaction:authorize",
  "data": { ... }, // Same data as in Create an authorize session
  "options": {
    "authorize": {
      "mode": "headless"
    }
  }
}
```

See [`AuthorizeFlowOptions`](https://developer.uphold.com/widgets/payment/sdk-reference#authorizeflowoptions) in the SDK reference for the full type definition.

### Handle the complete event

> [!WARNING]
>
> The `complete` event does not guarantee success. Always check `transaction.status` and `trigger.reason`.

```javascript Web SDK theme={null}
widget.on('complete', (event) => {
  const { transaction, trigger } = event.detail.value;

  if (trigger.reason === 'transaction-status-changed') {
    if (transaction.status === 'completed') {
      // Show success — the transfer settled
    } else if (transaction.status === 'failed') {
      // Map transaction.statusDetails.reason to a user-facing message
    }
  } else if (trigger.reason === 'max-retries-reached') {
    // Widget stopped polling — continue monitoring via webhooks or polling
  }

  widget.unmount();
});
```

```javascript Without SDK theme={null}
// Inside the onMessage switch from Set up the widget
case 'complete': {
  const { transaction, trigger } = event.data.value;

  if (trigger.reason === 'transaction-status-changed') {
    if (transaction.status === 'completed') {
      // Show success — the transfer settled
    } else if (transaction.status === 'failed') {
      // Map transaction.statusDetails.reason to a user-facing message
    }
  } else if (trigger.reason === 'max-retries-reached') {
    // Widget stopped polling — continue monitoring via webhooks or polling
  }

  teardown();
  break;
}
```

Failure reasons in `transaction.statusDetails.reason`:

| Reason | Description |
| - | - |
| `apm-authorization-failed` | The Apple Pay authorization could not be completed |
| `card-declined` | The card was declined |
| `card-declined-by-bank` | The card was declined by the issuing bank |
| `card-expired` | The card has expired |
| `card-permanently-declined-by-bank` | The card was permanently declined |
| `card-unauthorized` | The card authorization was not completed |
| `card-unsupported` | The card is not supported for this operation |
| `insufficient-funds` | The origin account has insufficient funds |
| `provider-maximum-limit-exceeded` | The transaction exceeds provider limits |
| `velocity` | The transaction was blocked by velocity rules |
| `unspecified-error` | The transaction failed for an unspecified reason |

### Handle cancellations

The `cancel` event fires when the user dismisses the Apple Pay sheet or navigates back without completing authorization.

```javascript Web SDK  theme={null}
widget.on('cancel', () => {
  widget.unmount();
  // Return the user to the previous screen
});
```

```javascript Without SDK theme={null}
// Inside the onMessage switch from Set up the widget
case 'cancel':
  teardown();
  // Return the user to the previous screen
  break;
```

### Handle errors

The `error` event fires for critical unrecoverable errors — except `authorize_transaction_failed`, which is retryable **in headless mode**: the widget resets itself back to its ready state, so the Apple Pay button works again if you leave the widget mounted. In default mode there is no in-place retry for this code — the button does not become usable again, so unmount and create a new authorize session if you want the user to try again.

`authorize_transaction_failed` is the retryable code for Apple Pay authorization and transaction-creation failures. `event.detail.error.details.reason` narrows down where it happened:

| Reason | Description |
| - | - |
| `unable-to-create-payment-request` | The browser could not build the Apple Pay payment request |
| `unable-to-make-payment` | The device or browser reported it cannot make this payment |
| `unable-to-show-payment-request` | The Apple Pay sheet could not be shown |
| `invalid-payment-response` | The Apple Pay sheet returned a response without the expected payment token |
| `unable-to-create-transaction` | Apple Pay authorization succeeded, but the transaction itself could not be created — see `event.detail.error.cause` below for the underlying reason |

The reason can also be `unable-to-create-merchant-session`, when the merchant session validation with Apple failed.

Other failures in this flow — such as a missing or expired quote, or Apple Pay not being available — surface with their own `code` and are not retryable; handle those with a generic fallback.

When the device or browser can't make Apple Pay payments, the Widget fires `error` with `code: 'apple_pay_not_available'` and `message: 'Apple Pay is not available.'`. For withdrawals, this also happens when the device doesn't support Apple Pay payouts. See [Browser and platform compatibility](https://developer.uphold.com/developer-guides/apm-transfers/introduction.md#browser-and-platform-compatibility-payment-widget).

As with any Widget error, the original failure is preserved in [`event.detail.error.cause`](https://developer.uphold.com/widgets/payment/sdk-reference#error). When `details.reason` is `unable-to-create-transaction`, it is the error of [Create transaction](https://developer.uphold.com/rest-apis/core-api/transactions/create-transaction.md), with the same `code` and `details` as in the [Request errors](https://developer.uphold.com/developer-guides/apm-transfers/withdrawal/via-rest-api/apple-pay.md#request-errors) table of the REST API guide, and the status in `httpStatusCode`.

```javascript Web SDK theme={null}
// Set this to match how you configured the widget — see Headless mode above
const isAuthorizeHeadless = false;

widget.on('error', (event) => {
  const { code, cause, details } = event.detail.error;
  console.error('Widget error:', code, details, cause);

  if (code === 'authorize_transaction_failed') {
    if (details.reason === 'unable-to-create-transaction') {
      // The real reason is nested here, not in the top-level `code`
      console.error('Create transaction failed:', cause?.code);
    }

    if (isAuthorizeHeadless) {
      // Retryable in headless mode — keep the widget mounted if you want the user to try again
      return;
    }
    // In default mode there is no in-place retry for this code — fall through and unmount
  }

  widget.unmount();
  // Show a user-friendly error message
});
```

```javascript Without SDK theme={null}
// Inside the onMessage switch from Set up the widget. `isAuthorizeHeadless` is declared once
// outside the handler (alongside `sessionOrigin`), matching how you configured the widget.
case 'error': {
  const { code, cause, details } = event.data.error;
  console.error('Widget error:', code, details, cause);

  if (code === 'authorize_transaction_failed') {
    if (details.reason === 'unable-to-create-transaction') {
      console.error('Create transaction failed:', cause?.code);
    }

    if (isAuthorizeHeadless) {
      // Retryable in headless mode — keep the iframe/WebView mounted so the user can try again
      break;
    }
    // In default mode there is no in-place retry for this code — fall through and teardown
  }

  teardown();
  // Show a user-friendly error message
  break;
}
```

> [!WARNING]
>
> The Payment Widget handles most errors internally. For unrecoverable errors, the widget fires an `error` event. It is the host application's responsibility to handle these events, present an error message to the user, and unmount the widget.

***

## Monitor for settlement

Apple Pay withdrawal transactions remain in `processing` while the payment settles. Monitor until the transaction reaches a terminal state.

* **Webhook events** (recommended):
  * [core.transaction.created](https://developer.uphold.com/rest-apis/core-api/transactions/webhooks/transaction-created.md) — `status: processing` → transaction created, pending settlement
  * [core.transaction.status-changed](https://developer.uphold.com/rest-apis/core-api/transactions/webhooks/transaction-status-changed.md) — `status: completed` → funds settled; `status: failed` → irrecoverable error
* **Polling** (fallback): [Get transaction](https://developer.uphold.com/rest-apis/core-api/transactions/get-transaction.md)

***

## Sample transaction

In a successful Apple Pay withdrawal, the origin is the user's `account` and the destination is an `apm` node with the method as `{apmMethod}`. The transaction status is initially `processing` and updates to `completed` once the transfer settles.

```json [expandable] theme={null}
{
  "transaction": {
    "id": "9b2f4a17-5e3c-4d77-a8e1-9bcdef2c0a42",
    "origin": {
      "asset": "USD",
      "amount": "15.00",
      "node": {
        "type": "account",
        "id": "b8618cd1-ccb0-4a72-985f-3bb0d268dabd",
        "ownerId": "48e40cb2-6c34-44ce-b2f1-6adac459bb37"
      }
    },
    "destination": {
      "asset": "USD",
      "amount": "15.00",
      "node": {
        "type": "apm",
        "method": "apple-pay"
      }
    },
    "status": "completed",
    "quotedAt": "2025-06-18T00:55:39Z",
    "createdAt": "2025-06-18T00:56:39Z",
    "updatedAt": "2025-06-18T00:57:08Z",
    "denomination": {
      "asset": "USD",
      "amount": "15.00",
      "target": "origin"
    },
    "fees": []
  }
}
```

***

## 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:

![Apple Pay transaction completed confirmation](https://mintcdn.com/uphold-d4756e17/WuOkmqXUUvhqHoz9/developer-guides/apm-transfers/_media/apple-pay-withdrawal-transaction-completed.png?fit=max\&auto=format\&n=WuOkmqXUUvhqHoz9\&q=85\&s=655e9081d02a0e161af1168285d71180)

***

## Troubleshooting

Having issues rendering Apple Pay? See [Troubleshooting](https://developer.uphold.com/widgets/payment/installation-and-setup.md#troubleshooting) in the Payment Widget installation guide.

***

> [!TIP]
>
> You now support Apple Pay withdrawals via the Payment Widget.

## Request errors

[Create quote](https://developer.uphold.com/rest-apis/core-api/transactions/create-quote.md) and [Create transaction](https://developer.uphold.com/rest-apis/core-api/transactions/create-transaction.md) reject a request with an HTTP error when it can't go ahead, in which case no transaction is created. The table only lists the errors your integration should act on, such as by showing the user a message. The other errors usually point to an issue in your integration. See the API reference of each endpoint for the full list. The Payment Widget creates the transaction, so errors from creating it reach you through its `error` event instead: an `authorize_transaction_failed` error whose `event.detail.error.cause` is the original error, with the status in `httpStatusCode` and the same `code` and `details` as in the table. Errors from creating the quote are returned to your backend as usual.

| Error | Cause | Recommended action |
| - | - | - |
| `409 user_capability_failure` | The user can't make the withdrawal. `details.capability` lists the `requirements` to complete and the `restrictions` that apply. | Have the user complete the requirements, or explain the restriction. |
| `409 transaction_amount_invalid` (`minimum-limit-not-met`, `maximum-limit-exceeded`) | The amount is below the minimum or above the maximum of a single withdrawal. | Show the limit from `details.limit` and ask for another amount. |
| `409 transaction_amount_invalid` (`amount-exceeds-daily-limit`, `amount-exceeds-weekly-limit`, `amount-exceeds-monthly-limit`) | The amount exceeds the user's limit for the period. | Show the `details.limit.remainingAmount` and ask for a lower amount. |
| `409 transaction_amount_invalid` (`transacting-unsettled-funds`) | The amount relies on funds from a deposit that hasn't settled yet, such as an ACH deposit. | Tell the user when the funds become available (`details.unsettledFunds.settlementAt`), or offer to withdraw the amount minus `details.unsettledFunds.shortfallAmount`. See [Unsettled funds](https://developer.uphold.com/rest-apis/core-api/transactions/overview.md#unsettled-funds). |
| `409 insufficient_balance` | The origin account doesn't have enough available funds. | Refresh the balance and ask for a lower amount. |
| `409 operation_not_allowed` (`duplicate-withdrawal`) | When creating the transaction, a withdrawal of the same amount from the same origin to the same destination was made in the last few minutes. | Don't retry automatically. Tell the user that a matching withdrawal was just made, and let them try again later if it's intended. |
| `409 operation_not_allowed` (`country-restricted-transaction`) | The withdrawal isn't allowed for the user's country. | Tell the user the withdrawal isn't available to them. |
| `404 entity_not_found` (`entity: "quote"`) | When creating the transaction, the quote expired or no longer exists. | Create a new quote and ask the user to confirm again. |
| `409 operation_not_allowed` (`quote-rate-variance-not-allowed`) | When creating the transaction, the rate moved too far from the rate of the quote. Only applies when the withdrawal converts between assets. | Create a new quote and ask the user to confirm again. |
| `409 operation_not_allowed` (`unspecified-error`) | The request failed for another reason. | Show a generic error, and ask the user to try again or contact support. |

## Failure reasons

A transaction that was created can still fail afterwards: its `status` becomes `failed`, or `on-hold` when information is requested, and `statusDetails.reason` says why. You learn about it through the [`core.transaction.status-changed`](https://developer.uphold.com/rest-apis/core-api/transactions/webhooks/transaction-status-changed) webhook, or by polling [Get transaction](https://developer.uphold.com/rest-apis/core-api/transactions/get-transaction.md). The table only lists the reasons your integration should act on, such as by notifying the user.

| Reason | Cause | Recommended action |
| - | - | - |
| `apm-account-holder-data-mismatch`, `apm-missing-account-holder-data` | The payment provider couldn't match the account holder details. | Ask the user to check their account details and try again. |
| `apm-authorization-failed`, `apm-payment-method-declined` | The payment provider didn't authorize the withdrawal, or declined the payment method. | Ask the user to try another payment method. |
| `velocity` | Too many transactions were made in a short time. | Ask the user to try again later. |
| `provider-maximum-limit-exceeded` | The amount exceeds what the payment provider allows. | Ask the user to try a lower amount. |
| `pending-requests-for-information` | The transaction is `on-hold` until the requested information is provided. | Have the user provide it. See [Requests for information](https://developer.uphold.com/rest-apis/core-api/transactions/overview.md#requests-for-information-rfis). |
| `unspecified-error` | The transaction failed for another reason. | Tell the user the transaction failed, and ask them to try again or contact support. |
