# Payment Widget

We provide ready to use widget that can be integrated into your app in less than 30 minutes

<div><figure><img src="/files/LtX3GblGTFfaIh9Be0T3" alt=""><figcaption></figcaption></figure> <figure><img src="/files/sXEbS7sYaGDroHIxZFbx" alt=""><figcaption></figcaption></figure> <figure><img src="/files/AVESvR4SsIPKcvzXGUoi" alt=""><figcaption></figcaption></figure></div>

[Go to SimplePay Demo Widget ↗️](https://widget-test-gamma.vercel.app/)

## Installation

To install Widget use package manager or load script from CDN

{% tabs %}
{% tab title="TypeScript" %}

```shell
npm install --save-dev @simplepay-ai/widget
```

```typescript
import '@simplepay-ai/widget';
```

{% endtab %}

{% tab title="jsDelivr" %}

```html
<script src="https://cdn.jsdelivr.net/npm/@simplepay-ai/widget@0/dist/widget.min.js" type="module"></script>
```

{% endtab %}

{% tab title="Skypack" %}

```html
<script src="https://cdn.skypack.dev/-/@simplepay-ai/widget@v0.0.4-J8bM7EPrp28FSp8FCgOy/dist=es2019,mode=raw/dist/widget.js" type="module"></script>
```

{% endtab %}

{% tab title="UNPKG" %}

```html
<script src="https://unpkg.com/@simplepay-ai/widget@0.0.4/dist/widget.js" type="module"></script>
```

{% endtab %}
{% endtabs %}

Then add component to desired place on page

```html
<payment-app
    price="0.8"
    appId="09476f0c-ed36-4dfe-84f4-ef2df1644830"
    clientId="bf298925-2f45-492c-891d-f997aa7ac864" # UUID or Int
    backToStoreUrl="https://example.com"
/>
```

## Configuration

Component configuration may be done via html attributes

Available attributes:

| Attribute        | Required | Description                                                                                    |
| ---------------- | -------- | ---------------------------------------------------------------------------------------------- |
| `appId`          | ✅        | ID of application, may be obtained in [Console](https://console.simplepay.ai/settings)         |
| `clientId`       | ✅        | ID of end customer who making payment. Should be linked to customer entry in merchant database |
| `backToStoreUrl` |          | URL where to redirect customer after payment                                                   |
| `price`          |          | Price for invoice in fiat currency                                                             |
| `dark`           |          | Dark theme on/off                                                                              |
| `invoiceId`      |          | Returns to the current step of the payment process or the receipt                              |


---

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

```
GET https://dev.simplepay.ai/docs/components/widget.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
