---
title: "Create a payment"
method: POST
path: "/payments"
---

# Create a payment

`POST /payments`

## Request

- Base URL: `https://api.sandbox.cleeng.com/3.1`
- URL: `https://api.sandbox.cleeng.com/3.1/payments`
- Auth: API key in header `X-Publisher-Token`

To create a payment, you use a payment resource. They are a reference to the actual payment that happens at the payment gateway.

Payments handle customers' actual payments of previously defined orders.

## Headers

- `Content-Type` string

## Request body

- object
  - `orderId` string, required: The identifier of Cleeng order
  - `status` string, required: The status of payment, available statuses are `rejected`, `authorized`, `cancelled`, `captured`.
  - `paymentOperation` string, required: Payment operation type: `initial-payment`, `recurring-payment`.
  - `paymentDetailsId` string: The identifier of Cleeng payment details connected to Cleeng customer. Required when `paymentDetails` are not created in the call
  - `paymentDetails` object
    - `token` string: the identifier of recurring payment details. Used to trigger payment on behalf the client
    - `paymentMethodSpecificParams` object: the specific details of the payment method used by the client
      - `holderName` string
      - `lastCardFourDigits` string
      - `variant` string
      - `cardExpirationDate` string
  - `externalPaymentId` string: The payment identifier from external payment gateway system
  - `rejectedReason` string: A reason of rejected payment, available when status equals `rejected`
  - `refundedReason` string: A reason of refunded payment, available when status equals `refunded`
  - `subscriptionId` string: Subscription identifier at Cleeng, it is used in order to define for which subscription recurring payment should be made. <br /> **Required conditionally** - when `paymentOperation` is set to `recurring-payment`.

## Response `200`

200

- object
  - `success` boolean
  - `payment` object
    - `id` integer
    - `orderId` integer
    - `status` string
    - `totalAmount` integer
    - `currency` string
    - `customerId` integer
    - `paymentGateway` string
    - `paymentMethod` string
    - `externalPaymentId` string
    - `couponId` unknown
    - `amount` number
    - `country` string
    - `offerType` string
    - `taxValue` number
    - `paymentMethodFee` integer
    - `customerServiceFee` integer
    - `rejectedReason` unknown
    - `refundedReason` unknown
    - `paymentDetailsId` unknown
    - `paymentOperation` string
  - `message` string

## Other responses

- `400`: 400
- `401`: 401
- `422`: 422

---

[API](https://skmtc.dev/cleeng/apis/api-31.md) - [All operations](https://skmtc.dev/cleeng/apis/api-31/llms.txt) - [OpenAPI document](https://skmtc.dev/cleeng/apis/api-31/revisions/df55396cda4f?raw)
