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

# Unreal Engine Integration

> Blueprints and C++ examples to integrate Gx402 payments in Unreal Engine.

# Unreal Engine Integration

Gx402 provides Blueprint-first and C++-first patterns for calling x402 via your Express middleware. Unreal packaging, platform constraints, and input methods differ from Unity — this guide focuses on practical handoff patterns (deep links, companion apps, WalletConnect).

***

## Prerequisites

* Unreal Engine 4.27+ or Unreal Engine 5
* A way to open external browser or webview from a packaged game (for WalletConnect)
* Companion app / deep-link support for consoles or tight packaging scenarios
* A Gx402 Express middleware running the `/create-payment` and `/confirm-payment` endpoints

***

## Typical flow (packaged & Blueprint-friendly)

1. Player triggers purchase in UI (Blueprint event).
2. CreatePaymentNode calls your backend `/create-payment`.
3. Backend returns `payload` + `paymentId`.
4. Game opens WalletConnect session (external browser or system webview).
5. Wallet signs payload; companion app or deep-link returns signature.
6. Game calls `/confirm-payment` with signature to finalize.

***

## Blueprint concept

* `OnBuy` -> `CreatePaymentNode` -> `OnSuccess` -> `OpenWalletConnect` -> Wait -> `ConfirmPaymentNode` -> `OnFinal` grant item.

***

## C++ (pseudo)

```cpp theme={null}
// C++ concept using FHttpModule
void UMyStore::CreatePayment(FString ItemId) {
  // POST /create-payment -> parse payload, paymentId
  // Launch external WalletConnect URL
  // Wait for a REST callback or deep link to deliver signature
  // POST /confirm-payment with signature
}
```
