---
title: "Create Public Payment"
method: POST
path: "/api/payments/public"
tags: ["Payments"]
---

# Create Public Payment

`POST /api/payments/public`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/payments/public`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Create a payment on behalf of a guest (unauthenticated) customer.

The caller must supply the project's `public_key` matching
``project.data.config.payment_widget.public_payment_key``. Only ``intent=sale`` is allowed;
the destination wallet and recipient_project_id are taken from the project's
payment_widget config — the caller cannot override them.

Returns the same shape as POST /api/payments/: `{ payment_id, client_secret }` (Stripe)
or `{ payment_id, payment_url }` (Tochka).

## Headers

- `Idempotency-Key` string

## Request body

- PublicPaymentRequest: Request body for guest/public checkout via POST /api/payments/public.
  - `project_id` integer, required: Project to pay
  - `public_key` string, required: Must match project.data.config.payment_widget.public_payment_key
  - `amount` number, required: Payment amount in major units
  - `currency` string: ISO currency code
  - `description` string: Description shown to the payer
  - `country` string, nullable: ISO country for provider matrix
  - `preferred_method` string, nullable: card | stripe | tochka
  - `success_url` string, nullable: Redirect URL on success (Tochka)
  - `fail_url` string, nullable: Redirect URL on failure (Tochka)
  - `base_url` string, nullable: Deployment base URL to derive notification_url
  - `use_project_keys` boolean, nullable: If true and project has use_project_keys in widget, use BYOK keys (same rules as POST /payments)

## Response `200`

Successful Response

- unknown

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/agentstack/apis/agentstack-core-api.md) · [All operations](https://skmtc.dev/agentstack/apis/agentstack-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentstack/apis/agentstack-core-api/revisions/79f4a4dd8813?raw)
