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

# Quickstart

> Create a hosted payment link and take your first payment in under five minutes

This is the fastest path to a live payment with Payment Links: create a link, open it, pay with a test card, and see the result. One path, no options to weigh. For embedding card fields directly in your own checkout instead, see the [JavaScript SDK quickstart](/docs/ecom/jssdk/quickstart).

<Steps>
  <Step title="Create a payment link">
    Call `POST /payment-links` with your API key. `Idempotency-Key` is required on create. Amounts are integers in the currency's smallest unit; for PHP that is centavos (`150000` is PHP 1,500.00).

    ```bash theme={null}
    curl 'https://api.sbx.moduluslabs.io/ecom/v1/payment-links' \
      -H 'X-API-Key: sk_test_...' \
      -H 'Content-Type: application/json' \
      -H 'Idempotency-Key: order-1234' \
      -d '{
        "type": "ONE_TIME",
        "merchant_branch_reference_number": "SH-ANG-001",
        "currency": "PHP",
        "amount": 150000,
        "description": "Order #1234",
        "line_items": [
          { "sku": "TOUR-001", "name": "Day Tour", "unit_price": 150000, "quantity": 1 }
        ],
        "expires_at": "2035-12-31T00:00:00Z",
        "order_reference": "order-1234",
        "redirect_urls": {
          "success": "https://your-site.example/paid",
          "declined": "https://your-site.example/declined",
          "expired": "https://your-site.example/expired"
        }
      }'
    ```

    <Note>
      `merchant_branch_reference_number` is required when your key is scoped to a **partner** or **merchant**. Branch-scoped keys can omit it. When `line_items` are supplied, `amount` must equal their sum (`unit_price` times `quantity`).
    </Note>
  </Step>

  <Step title="Share the returned URL">
    The `201` response contains the hosted checkout `url`. Send it to your customer.

    ```json theme={null}
    {
      "id": "0192a1b2-c3d4-7e5f-8a6b-1c2d3e4f5a6b",
      "type": "ONE_TIME",
      "merchant_branch_reference_number": "SH-ANG-001",
      "currency": "PHP",
      "amount": 150000,
      "line_items": [
        { "sku": "TOUR-001", "name": "Day Tour", "unit_price": 150000, "quantity": 1 }
      ],
      "status": "ACTIVE",
      "expires_at": "2035-12-31T00:00:00Z",
      "url": "https://pay.sbx.moduluslabs.io/0192a1b2-c3d4-7e5f-8a6b-1c2d3e4f5a6b",
      "successful_payment_count": 0,
      "description": "Order #1234",
      "order_reference": "order-1234",
      "max_uses": 1,
      "redirect_urls": {
        "success": "https://your-site.example/paid",
        "declined": "https://your-site.example/declined",
        "expired": "https://your-site.example/expired"
      },
      "metadata": {},
      "cancelled_at": null,
      "cancellation_reason": null,
      "created_at": "2026-09-04T08:00:00Z",
      "updated_at": "2026-09-04T08:00:00Z"
    }
    ```
  </Step>

  <Step title="Pay with a test card">
    Open the `url` and pay with a sandbox card. Use a 3DS challenge card and enter OTP `1234`:

    `4000 0000 0000 2503`   exp `12/28`   CVC `123`   OTP `1234`

    No real money moves. The full card set is on the [Testing](/docs/testing) page.
  </Step>

  <Step title="Confirm and reconcile">
    After payment, the customer is returned to your `redirect_urls.success`. Confirm the result server-side by [retrieving the payment link](/api-reference/ecom/retrieve-payment-link) and reading its `status` and `successful_payment_count`. Match it to your order with the `order_reference` you set at creation.
  </Step>
</Steps>

The snippets above show the complete request and response. Add your sandbox API key (and a `merchant_branch_reference_number` if your key is partner- or merchant-scoped) to run them.

<Tip>
  **Building with an AI agent?** Point Claude Code, Cursor, or any AI agent at these docs to scaffold the integration. See [Build with AI](/docs/build-with-ai).
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/ecom/create-payment-link">
    Every field on every Payment Links endpoint
  </Card>

  <Card title="Authentication" icon="key" href="/docs/ecom/authentication">
    Keys, entity scoping, and idempotency
  </Card>

  <Card title="JavaScript SDK" icon="browser" href="/docs/ecom/jssdk/introduction">
    Collect cards inside your own checkout
  </Card>

  <Card title="Testing" icon="vial" href="/docs/testing">
    Test cards and scenarios
  </Card>
</CardGroup>
