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

# Quickstart: One-Time Payments

> Accept your first payment with the Payment Sessions API

This guide walks through creating a one-time payment session, launching the hosted checkout, and handling the completion webhook.

## Prerequisites

* A test API key. See [Authentication](/api-reference/getting-started/authentication).
* A registered webhook endpoint. See [Webhook Setup](/api-reference/webhooks/setup) to register your URL and obtain your signing key.

***

## Step 1: Create a payment session

Create a session server-side using your **secret key**. The minimum required fields are `amount` and `currency`.

```bash theme={"system"}
curl -X POST https://api.momentpay.net/collect/payment_sessions \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10000,
    "currency": "ZAR"
  }'
```

<Note>
  `amount` is always specified in minor units. See [Monetary Amounts](/api-reference/getting-started/monetary_amounts) for details.
</Note>

The response includes a `session_url` (the hosted checkout page your customer will use to complete payment) and an `id` you will use to match the subsequent webhook event.

```json theme={"system"}
{
  "id": "ps_kfAWZgfQIoeG0q",
  "status": "active",
  "payment_status": "unpaid",
  "payment_outcome": "not_started",
  "amount": 10000,
  "currency": "ZAR",
  "session_url": "https://checkout.momentpay.net/ckt802zEb2P2uS4Ql",
  "created_at": "2025-03-18T14:06:51.149Z",
  "updated_at": "2025-03-18T14:06:51.149Z"
}
```

***

## Step 2: Launch the checkout

Redirect your customer to the `session_url`, or embed it using the [JavaScript SDK](/libraries-and-sdks/web/javascript) for an in-page modal or inline experience.

The session remains `active` until the customer completes payment or the session expires. Do not poll for status. Use the webhook in the next step instead.

***

## Step 3: Handle the completion webhook

When the customer completes payment, Moment sends a `payment_session.completed` event to your registered webhook endpoint.

```json theme={"system"}
{
  "id": "wh_e5cf73f1b3e4451c8c474fe56bfc688d",
  "type": "payment_session.completed",
  "data": {
    "id": "ps_kfAWZgfQIoeG0q",
    "status": "completed",
    "payment_status": "paid",
    "payment_outcome": "paid",
    "amount": 10000,
    "currency": "ZAR",
    "payment_id": "pay_87C7PAP35KcdpzAgckBvB"
  }
}
```

Match `data.id` in the event to the session you created in Step 1 to confirm which order was paid.

Before processing, verify the event signature to confirm it originated from Moment. See [Webhook Verification](/api-reference/webhooks/verification) for the full verification steps and code samples.

Respond with a `2xx` status code to acknowledge receipt. If your endpoint does not respond in time, Moment will retry delivery.

***

## Testing

Use test card `4242 4242 4242 4242` with any future expiry date and any 3-digit CVC to simulate a successful payment. See [Integration Testing](/api-reference/getting-started/testing) for the full list of test cards and error scenarios.

***

## Next steps

<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-6">
  <Card title="Quickstart: Recurring Payments" icon="repeat" href="/api-reference/collect/payment_sessions/quickstart-recurring">
    Set up a mandate and collect future payments without customer interaction.
  </Card>

  <Card title="Authorisation and Capture" icon="hand" href="/documentation/collect/payment-sessions/authorisation-capture/overview">
    Reserve funds at checkout and capture or void them later.
  </Card>

  <Card title="Payment Method Verification" icon="shield-check" href="/documentation/collect/payment-sessions/payment-method-verification">
    Verify and save a card without charging the customer.
  </Card>

  <Card title="JavaScript SDK" icon="js" href="/libraries-and-sdks/web/javascript">
    Embed checkout directly in your page with the Moment JS SDK.
  </Card>
</div>
