---
title: "Update a payment"
method: PATCH
path: "/payments/{paymentId}"
---

# Update a payment

`PATCH /payments/{paymentId}`

## Request

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

To update a payment, you use payments resource. They are a reference of the actual payment that happens at the payment gateway.

Payments handle customers' actual payments of previously defined order.

## Path parameters

- `paymentId` integer, required

## Headers

- `Content-Type` string

## Request body

- object
  - `orderId` integer, required: The identifier of Cleeng order. **Required when** `status` ≠ `refunded`.
  - `status` string, required: The status of payment, available statuses are `rejected`, `captured`, `refunded`.
  - `paymentOperation` string: Payment operation type: initial-payment, initial-free-transaction, recurring-payment. **Required when** `status` ≠ `refunded`.
  - `externalPaymentId` string: The payment identifier from external payment gateway system
  - `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
  - `rejectedReason` string: A reason of rejected payment. **Required only** when `status` equals `rejected`.
  - `refundedReason` string: A reason of refunded payment. **Required only** when `status` equals `refunded`.
  - `refundedAmount` number, float: Refunded amount. Values bigger than 0.0
  - `refundType` string: Type of refund: `refund`or `chargeback`

## Response `200`

200

- object
  - `success` boolean
  - `payment` object
    - `paymentId` integer
    - `publisherId` integer
    - `orderId` integer
    - `paymentDetailsId` integer
    - `paymentDetails` unknown
    - `paymentStatus` string
    - `rejectedReason` unknown
    - `refundedReason` unknown
    - `refundedAmount` unknown
    - `paymentOperation` string
    - `externalPaymentId` unknown
    - `subscriptionId` unknown
  - `message` string

## Other responses

- `400`: 400
- `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)
