> For the complete documentation index, see [llms.txt](https://docs.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alternativepayments.io/web-sdk/components/payment-result.md). Agents can also search and read this documentation through its [MCP server](https://docs.alternativepayments.io/~gitbook/mcp).

# Payment Result

Displays the outcome of a payment attempt (success, error, or processing).

***

## Usage

```typescript
const result = client.components.paymentResult({
  containerId: 'result',
  status: 'success',
  payment: paymentObject,
  onDone: () => {
    console.log('Done clicked');
  },
});
```

***

## Configuration

### PaymentResultConfig

<table><thead><tr><th width="132.30078125">Property</th><th>Type</th><th width="106.38671875">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>containerId</code></td><td><code>string</code></td><td>Yes</td><td>ID of the container element</td></tr><tr><td><code>status</code></td><td><code>'success' | 'error' | 'processing'</code></td><td>Yes</td><td>Payment outcome</td></tr><tr><td><code>payment</code></td><td><code>Payment</code></td><td>No</td><td>Payment details (for success)</td></tr><tr><td><code>error</code></td><td><code>Error</code></td><td>No</td><td>Error details (for error status)</td></tr><tr><td><code>theme</code></td><td><code>ThemeConfig</code></td><td>No</td><td>Custom theme configuration</td></tr><tr><td><code>onDone</code></td><td><code>() => void</code></td><td>No</td><td>Called when "Done" is clicked</td></tr><tr><td><code>onRetry</code></td><td><code>() => void</code></td><td>No</td><td>Called when "Retry" is clicked (errors)</td></tr></tbody></table>

***

## Status Types

### Success

Shows a success message with payment details.

```typescript
const result = client.components.paymentResult({
  containerId: 'result',
  status: 'success',
  payment: {
    id: 'pay_xxx',
    amount: 150.00,
    currency: 'USD',
    // ...
  },
  onDone: () => {
    window.location.href = '/dashboard';
  },
});
```

### Error

Shows an error message with retry option.

```typescript
const result = client.components.paymentResult({
  containerId: 'result',
  status: 'error',
  error: new Error('Card declined'),
  onRetry: () => {
    // Go back to payment method selection
    showPaymentMethods();
  },
  onDone: () => {
    window.location.href = '/dashboard';
  },
});
```

### Processing

Shows a processing indicator for async payments.

```typescript
const result = client.components.paymentResult({
  containerId: 'result',
  status: 'processing',
  onDone: () => {
    window.location.href = '/dashboard';
  },
});
```

***

## Example

```html
<div id="result"></div>

<script type="module">
  import { AlternativeClient } from '@getalternative/partner-sdk';

  const client = new AlternativeClient({
    accessToken: checkoutToken, // from your backend's POST /checkout-auth/init
  });

  // Get payment result from previous step
  const paymentResult = getPaymentResult();

  const result = client.components.paymentResult({
    containerId: 'result',
    status: paymentResult.success ? 'success' : 'error',
    payment: paymentResult.payment,
    error: paymentResult.error,
    onDone: () => {
      // Return to main application
      window.location.href = '/';
    },
    onRetry: () => {
      // Try again
      window.location.href = '/pay';
    },
  });
</script>
```

***

## Display

**Success screen shows:**

* Success icon and message
* Payment confirmation number
* Amount paid
* "Done" button

**Error screen shows:**

* Error icon and message
* Error details
* "Retry" button
* "Done" button

**Processing screen shows:**

* Loading indicator
* Processing message
* "Done" button (to continue anyway)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.alternativepayments.io/web-sdk/components/payment-result.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
