> 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-confirmation.md).

# Payment Confirmation

Review screen before submitting a payment. Shows invoice details, selected payment method, and payment amount.

***

## Usage

```typescript
const confirmation = client.components.paymentConfirmation({
  containerId: 'confirmation',
  invoiceId: 'inv_xxx',
  paymentMethodId: 'pm_xxx',
  customerId: 'cus_xxx',
  onPaymentSuccess: (payment) => {
    console.log('Payment successful:', payment.id);
  },
  onPaymentError: (error) => {
    console.error('Payment failed:', error);
  },
  onBack: () => {
    console.log('Back clicked');
  },
});
```

***

## Configuration

### PaymentConfirmationConfig

<table><thead><tr><th width="166.33203125">Property</th><th>Type</th><th width="106.58203125">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>invoiceId</code></td><td><code>string</code></td><td>Yes</td><td>Invoice being paid</td></tr><tr><td><code>paymentMethodId</code></td><td><code>string</code></td><td>Yes</td><td>Selected payment method</td></tr><tr><td><code>customerId</code></td><td><code>string</code></td><td>Yes</td><td>Customer making the payment</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>onConfirm</code></td><td><code>() => void</code></td><td>No</td><td>Called when payment is initiated</td></tr><tr><td><code>onBack</code></td><td><code>() => void</code></td><td>No</td><td>Called when "Back" is clicked</td></tr><tr><td><code>onPaymentSuccess</code></td><td><code>(payment: Payment) => void</code></td><td>No</td><td>Called when payment succeeds</td></tr><tr><td><code>onPaymentError</code></td><td><code>(error: Error) => void</code></td><td>No</td><td>Called when payment fails</td></tr><tr><td><code>onError</code></td><td><code>(error: Error) => void</code></td><td>No</td><td>Called on other errors</td></tr></tbody></table>

***

## Payment Object

The `onPaymentSuccess` callback receives a `Payment` object:

```typescript
interface Payment {
  id: string;
  status: 'PENDING' | 'COMPLETED' | 'FAILED';
  amount: number;
  currency: string;
  invoice_id: string;
  payment_method_id: string;
  created_at: string;
  // ... additional fields
}
```

***

## Example

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

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

  const client = new AlternativeClient({
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
  });

  // Get IDs from URL or state
  const params = new URLSearchParams(window.location.search);

  const confirm = client.components.paymentConfirmation({
    containerId: 'confirmation',
    invoiceId: params.get('invoice'),
    paymentMethodId: params.get('payment_method'),
    customerId: params.get('customer'),
    onPaymentSuccess: (payment) => {
      // Redirect to success page
      window.location.href = `/success?payment=${payment.id}`;
    },
    onPaymentError: (error) => {
      // Show error or retry
      alert('Payment failed: ' + error.message);
    },
    onBack: () => {
      window.history.back();
    },
  });
</script>
```

***

## Display

The confirmation screen shows:

* Invoice summary (number, amount, due date)
* Selected payment method details
* Total amount to be charged
* "Pay Now" button to submit payment
* "Back" button to return to previous screen


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
