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

# Okapay Quickstart: Make Your First Payment Request

> Create your Okapay merchant account, retrieve your API key, and make your first product creation and checkout session request in minutes.

This page walks you through everything you need to go from zero to your first live payment request. By the end you will have a merchant account, a working API key, a product in the system, and a checkout session ready to accept payments. All code examples use the PHP SDK. If you prefer raw REST calls, see the [Authentication](https://docs.okapay.net/authentication.md) guide for `curl` examples.

**1. Create your account**

Go to [dashboard.okapay.net/sign-up](https://dashboard.okapay.net/sign-up) and register with your email address. After signing up, verify your email using the confirmation link sent to your inbox, then complete your merchant profile in the dashboard. A complete profile is required before you can process live payments.

**2. Get your API keys**

In the merchant dashboard, navigate to **Dashboard → API Keys** at [dashboard.okapay.net/dashboard/api-keys](https://dashboard.okapay.net/dashboard/api-keys).

You will see two credentials you need:

* **Secret Key** (`sk_live_xxx`) — used for all server-side API calls. Keep this private.
* **Merchant ID** — your unique account identifier, required in checkout session endpoints.

Copy both values and store them securely.

> [!WARNING]
>
> Never include your Secret Key in frontend code, client-side JavaScript, or any publicly accessible file. It grants full API access to your account. Use environment variables on your server instead.

**3. Install the PHP SDK**

Install the official Okapay PHP SDK with Composer:

```bash theme={null}
composer require okapay/okapay-php
```

Add your Secret Key to your `.env` file:

```env theme={null}
OKAPAY_SECRET_KEY=sk_live_xxxxxxxxx
```

Do not commit your `.env` file to version control.

**4. Create your first product**

A **product** represents an item or service you sell. Create one using the SDK:

```php theme={null}
<?php
require __DIR__ . '/vendor/autoload.php';
use Okapay\Client;

$okapay = new Client(); // reads OKAPAY_SECRET_KEY from env

$product = $okapay->products()->create([
    'name'        => 'My First Product',
    'description' => 'A sample product',
    'status'      => 'published',
    'currency'    => 'USD',
    'unit_amount' => 2999, // $29.99 in cents
]);

echo $product['product']['id']; // your new product ID
```

The `unit_amount` field is always in the **smallest currency unit** (cents for USD). A value of `2999` equals \$29.99. Save the returned product ID — you will use it to associate products with checkout sessions.

> [!NOTE]
>
> You can also create and manage products directly from the merchant dashboard without writing any code.

**5. Create a checkout session**

A **checkout session** represents a single payment intent. Create one to generate a hosted checkout page your customer can pay through:

```php theme={null}
<?php
require __DIR__ . '/vendor/autoload.php';
use Okapay\Client;

$okapay = new Client();

$merchantId = 'your_merchant_id'; // from Dashboard → API Keys

$session = $okapay->sessions()->create($merchantId, [
    'amount'      => 2999,         // $29.99 in cents
    'currency'    => 'USD',
    'description' => 'Order #1',
    'source'      => 'custom_php',
]);

$sessionId   = $session['session_id'];
$checkoutUrl = $session['checkout_url']; // redirect your customer here
```

Redirect your customer to `$checkoutUrl` so they can complete payment using their preferred method — card, wallet, crypto, or local rail. Store `$sessionId` to verify the payment status afterwards.

**6. Verify the payment**

After your customer completes (or attempts) payment, verify the session status on your server:

```php theme={null}
$result = $okapay->sessions()->verify($merchantId, $sessionId);

if ($result['status'] === 'paid') {
    // Payment confirmed — fulfil the order
    echo 'Payment successful!';
} else {
    // Payment pending or failed
    echo 'Payment status: ' . $result['status'];
}
```

Always verify payment status server-side before fulfilling an order. Do not rely solely on client-side redirects to confirm payment.

## Next steps

> [card] [Authentication](https://docs.okapay.net/authentication.md)
>
> Learn how API key authentication works, how to pass keys securely, and how to handle auth errors.

> [card] [PHP SDK Guide](https://docs.okapay.net/integrations/php.md)
>
> Explore the full PHP SDK reference — products, sessions, Laravel setup, and testing.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.