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

# Examples

> Code examples and implementation guides

Get started quickly with ready-to-use code examples.

## Official Repository

<Card title="Quickei Gateway Example" icon="github" href="https://github.com/appdevsx/Quickei-Gateway-Example">
  Complete integration examples in PHP/Laravel with authentication, payment creation, status checking, and webhook handling.
</Card>

## Quick Examples

<Tabs>
  <Tab title="PHP">
    ```php theme={null}
    <?php
    // 1. Get access token
    $client = new \GuzzleHttp\Client();
    $auth = $client->post('https://quickei.io/pay/sandbox/api/v1/authentication/token', [
        'json' => [
            'client_id' => env('QUICKEI_CLIENT_ID'),
            'secret_id' => env('QUICKEI_SECRET_ID'),
        ],
    ]);
    $token = json_decode($auth->getBody())->data->access_token;

    // 2. Create payment
    $payment = $client->post('https://quickei.io/pay/sandbox/api/v1/payment/create', [
        'headers' => ['Authorization' => "Bearer $token"],
        'json' => [
            'amount'       => '50.00',
            'currency'     => 'EUR',
            'return_url'   => 'https://yoursite.com/success',
            'product_name' => 'Premium Plan',
            'order_number' => 'ORD-' . uniqid(),
        ],
    ]);
    $paymentUrl = json_decode($payment->getBody())->data->payment_url;

    // 3. Redirect customer
    return redirect($paymentUrl);
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    # 1. Get access token
    TOKEN=$(curl -s -X POST https://quickei.io/pay/sandbox/api/v1/authentication/token \
      -H "Content-Type: application/json" \
      -d '{"client_id":"YOUR_CLIENT_ID","secret_id":"YOUR_SECRET_ID"}' \
      | jq -r '.data.access_token')

    # 2. Create payment
    curl -X POST https://quickei.io/pay/sandbox/api/v1/payment/create \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "amount": "50.00",
        "currency": "EUR",
        "return_url": "https://yoursite.com/success",
        "product_name": "Premium Plan",
        "order_number": "ORD-001"
      }'
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    const axios = require('axios');
    const BASE = 'https://quickei.io/pay/sandbox/api/v1';

    // 1. Get access token
    const { data: auth } = await axios.post(`${BASE}/authentication/token`, {
      client_id: process.env.QUICKEI_CLIENT_ID,
      secret_id: process.env.QUICKEI_SECRET_ID,
    });

    // 2. Create payment
    const { data: payment } = await axios.post(`${BASE}/payment/create`, {
      amount: '50.00',
      currency: 'EUR',
      return_url: 'https://yoursite.com/success',
      product_name: 'Premium Plan',
      order_number: `ORD-${Date.now()}`,
    }, {
      headers: { Authorization: `Bearer ${auth.data.access_token}` },
    });

    // 3. Redirect customer
    res.redirect(payment.data.payment_url);
    ```
  </Tab>
</Tabs>

## POS Integration Example

```php theme={null}
// Create a POS order with QR code
$response = Http::withBasicAuth($clientId, $clientSecret)
    ->post('https://quickei.io/merchant-api/pos/v1/orders', [
        'amount'         => 25.00,
        'currency'       => 'EUR',
        'payment_method' => 'both',
        'reference'      => 'TABLE-5',
        'terminal_id'    => 'counter-a',
        'callback_url'   => 'https://yoursite.com/pos/webhook',
        'expires_in'     => 300,
    ]);

$qrData = $response['data']['qr_data'];       // For QR code display
$paymentUrl = $response['data']['payment_url']; // For payment page redirect
```
