> For the complete documentation index, see [llms.txt](https://docs.yodl.me/yodl-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yodl.me/yodl-documentation/integration-guide.md).

# Integration Guide

## Development Tasks

### 🔗  Payment Button&#x20;

On the checkout page you create a payment button/link to:

`https://yodl.me/$handle?amount=..&currency=..&memo=..`

* `$handle` is your YODL.me link
* `amount` is the amount of the payment in the minor denomination of the currency
* `currency` to indicate the invoice currency
* `memo` is your order/customer/cart ID, whatever you need to reconcile the payment

  (on stripe API it's called \`client\_reference\_id\`)

```javascript
handle = "unicorn_socks" // your yodl.me handle
amountInMinor = 500;     // for 5.00
invoiceCurrency = "USD"; // invoice currency, defaults to "USD"
memo = order.orderID;

queryParameters = "amount=${amountInMinor}&currency=${invoiceCurrency}&memo=${memo}";

<a href="https://yodl.me/${handle}?${queryParameters}" target="_blank">
  YODL Pay
</a>
```

### ✅ Success Redirect Page

When the checkout is completed and the payment is confirmed, YODL.me redirects the user back to the success redirect page hosted on your webshop. This URL is configured in the YODL.me account admin.&#x20;

The SDK appends to the URL, as query parameters the `chainId` and `txHash`. So you can engage in post-processing of the payment (similar to the webhook). However as we cannot guarantee that the user really returns to your page, you should still implement webhooks for consistent processing.

### ⚙️ Webhook

The webhook is called by the YODL.me backend when the payment was confirmed on-chain and when the payment is *probabilistically final* and unlikely to be reverted. The payload is minimal and only contains:

* `chainId`
* `txHash`
* `state` of the blockchain transaction: `confirmed` or `probabilistic`

1. The Webhook needs to query `yodl.me/api/tx/:chainId/:txHash` to retrieve the payment details: `pmt`
2. With the retrieve `pmt.memo` lookup the order/cart/customer
3. Verify in your code that the payment was not tampered with.&#x20;

   Use [API Endpoints](/yodl-documentation/api/api-endpoints.md#lookup-and-verify-a-payment-against-given-parameters)
4. Mark payment as complete and do your post processing

### 💾 Environment Variables

```
YODL_HANDLE=  # yodl.me/YOUR_HANDLE
YODL_API_KEY= # find in your yodl.me admin
```

## Flow and Sequence Diagram

<figure><img src="/files/Xp6s9IlQZ7l3pHSz0yA4" alt=""><figcaption></figcaption></figure>


---

# 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.yodl.me/yodl-documentation/integration-guide.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.
