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

# Checkout and payment status

> Resolve payment accounts, start unit checkout, obtain a price quote, and verify provider status.

Read [Payments API access and safety](https://viewerdocs.planpoint.io/api-documentation/payments/overview.md) before using these endpoints. All examples use synthetic records.

## Get payment account

`POST /api/get-payment-account` — **Public**

Required `userId` is the project owner's ID. Optional `projectId` supplies project context for provider mode selection.

```json Request theme={null}
{
  "userId": "000000000000000000000006",
  "projectId": "000000000000000000000001"
}
```

```json Response (200, illustrative configured account) theme={null}
{
  "stripeAccountId": "acct_EXAMPLE",
  "paystackPublicKey": "pk_test_EXAMPLE",
  "payPalClientId": "EXAMPLE_CLIENT_ID"
}
```

Unconfigured fields can be absent or null. If no provider is enabled, returns `200` with `{ "disabled": true, "message": "Feature is not enabled" }`. Invalid IDs return `400`; an unknown owner returns `404`.

Only public provider identifiers are returned. A localhost URL or copied project name does not guarantee test mode.

## Start Stripe unit checkout

`POST /api/stripe/create-checkout-session` — **Public**

Despite its name, this endpoint creates a **card PaymentIntent**, not a Stripe Checkout Session.

| JSON field | Required | Description |
| - | - | - |
| `userId` | Yes | Project owner's ID. |
| `projectId` | Yes | Project owned by `userId`. |
| `amount` | Yes | Positive number in major units representing the client's expected total. The server calculates the actual charge. |
| `currency` | Yes | Three-character currency code. Stored project currency takes precedence. |
| `units` | Yes | Nonempty array. Each item requires `_id` and nonempty `name`. IDs may identify units, commercial spaces, or variants belonging to this project. |
| `return_url` | Yes | Nonempty return URL; retained by the request contract but not used to create a hosted checkout URL. |
| `description` | No | Payment description. |
| `portalUserId` | No | Buyer ID used to associate the resulting reservation. |

```json Request theme={null}
{
  "userId": "000000000000000000000006",
  "projectId": "000000000000000000000001",
  "portalUserId": "000000000000000000000003",
  "amount": 100,
  "currency": "cad",
  "units": [{ "_id": "000000000000000000000002", "name": "A-101" }],
  "return_url": "https://example.com/payment-result"
}
```

```json Response (200) theme={null}
{
  "clientSecret": "<PAYMENT_INTENT_CLIENT_SECRET>",
  "amount": 100,
  "branding": null
}
```

`amount` is the actual charge in major units; display it rather than trusting a previously loaded price. `branding` is the connected account's primary color or `null`.

Use Stripe.js with the owner's connected account and returned client secret to confirm the PaymentIntent. Completion is recorded through the [Connect webhook](https://viewerdocs.planpoint.io/api-documentation/payments/webhooks.md#stripe-connect-webhook), not by the creation response.

For uniform charges, each item's price comes from the project's global amount; otherwise it comes from that item or variant's payable amount. Buy Now metadata can accompany eligible items, but its additional purchase-price amount is not added to the reservation fee.

Errors include `400` for invalid input/pricing or an unavailable Stripe connection, `403` for project/item access or disabled checkout, `404` for a missing owner, and `500` for a provider/server failure.

## Check Stripe payment status

`POST /api/stripe/session-status` — **Public**

Send the nonempty PaymentIntent ID (not a Checkout Session ID) and owner ID.

```json Request theme={null}
{
  "payment_intent_id": "pi_EXAMPLE",
  "userId": "000000000000000000000006"
}
```

```json Response (200) theme={null}
{ "status": "complete", "customer_email": null }
```

Stripe's `succeeded` status is mapped to `complete`; other PaymentIntent statuses are returned unchanged. `customer_email` is the receipt email or `null`. This reads provider state, not reservation persistence.

Errors use `error`: `400` for invalid input, `404` for a missing owner, and `500` if retrieval fails.

## Get a Paystack quote

`POST /api/paystack/quote` — **Public**

| JSON field | Required | Description |
| - | - | - |
| `userId` | Yes | Merchant/project owner's ID. |
| `projectId` | Conditional | Default project for items without their own `projectId`. |
| `units` | Yes | 1-500 objects with `_id` and optional `projectId`. Every item must resolve to a project. |

```json Request theme={null}
{
  "userId": "000000000000000000000006",
  "projectId": "000000000000000000000001",
  "units": [{ "_id": "000000000000000000000002" }]
}
```

```json Response (200) theme={null}
{
  "amount": 100,
  "currency": "ZAR",
  "priceQuote": "<SIGNED_PRICE_QUOTE>"
}
```

`amount` is in major units. For a group cart, supply each item's project; projects must belong to the same owner and use the same currency. The quote does not create a payment, reserve inventory, or acquire a hold.

Use a `PP-`-prefixed reference when starting the Paystack payment. Preserve this metadata in the provider transaction:

```json Paystack metadata theme={null}
{
  "userId": "000000000000000000000006",
  "projectId": "000000000000000000000001",
  "portalUserId": "000000000000000000000003",
  "planpoint": [{
    "_id": "000000000000000000000002",
    "name": "A-101",
    "projectId": "000000000000000000000001"
  }],
  "priceQuote": "<SIGNED_PRICE_QUOTE>"
}
```

For a group payment, include `groupId` and each item's project context. Do not forward hold tokens to Paystack. Convert the quoted amount to minor units for the Paystack client SDK (`Math.round(amount * 100)`).

Treat `priceQuote` as opaque; it is not a login token. It covers the owner, exact item IDs, total, and currency for 24 hours, checked at payment time when that timestamp is available. If it expires before payment, obtain a fresh quote. A quote is not an availability guarantee.

Errors include `400` for invalid input, missing project, invalid prices, or mixed currencies; `403` for wrong ownership/items or disabled payments; and `429` for rate limiting.

## Process Paystack payment success

`POST /api/paystack/payment-success` — **Portal buyer**

| JSON field | Required | Description |
| - | - | - |
| `reference` | Yes | Nonempty provider transaction reference. |
| `user` | Yes | Owner ID; this field is named `user`, not `userId`. |
| `metadata.units` | Yes | Array of objects with `_id`; retained in the request contract. Verified provider metadata determines what is processed. |
| `projectId` | No | Project context. |
| `groupId` | No | Group context. |

```json Request theme={null}
{
  "reference": "PP-00000000-0000-4000-8000-000000000001",
  "user": "000000000000000000000006",
  "projectId": "000000000000000000000001",
  "metadata": {
    "units": [{ "_id": "000000000000000000000002" }]
  }
}
```

```json Response (200) theme={null}
{ "success": true, "processed": 1, "skipped": 0 }
```

The server re-verifies the reference with Paystack. It uses the verified transaction's `metadata.planpoint`, not the submitted unit list, and checks merchant/project context and payment eligibility. Counters report processing results; skipped items or optional `familyFailures` require checking stored state. Do not treat `success: true` alone as proof that every cart item was reserved.

Invalid input or payment verification returns `400`, missing/revoked Portal sessions `401`, payment account/project mismatches or rejected processing `403`, and an unknown owner `404`. Errors can use either `message` or `error`; rejected processing returns `{ "success": false, "error": "Payment could not be authorized for the selected units." }`.

The signed Paystack webhook is the separate completion path when a browser callback cannot finish, including checkout without a Portal session.

## Check Paystack payment status

`POST /api/paystack/session-status` — **Public**

Required fields: `reference` and owner `userId`. Optional `projectId` supplies mode-selection context.

`reference` must be 1-100 characters, using only letters, numbers, `.`, `_`, `=`, and `-`, and must not contain `..`.

```json Request theme={null}
{
  "reference": "PP-00000000-0000-4000-8000-000000000001",
  "userId": "000000000000000000000006",
  "projectId": "000000000000000000000001"
}
```

```json Response (200) theme={null}
{
  "status": "success",
  "reference": "PP-00000000-0000-4000-8000-000000000001",
  "amount": 10000,
  "currency": "ZAR",
  "paid_at": "2026-11-27T12:00:00.000Z"
}
```

`amount` here is in **minor units**, unlike the quote response. Provider fields may be absent if unavailable. This lookup does not create or link a reservation.

Errors use `error`: `400` for invalid input/provider verification failure, `404` for a missing owner, and `500` for missing provider configuration or retrieval failure.


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