---
title: "Update a payment on an offer"
description: "Update a deep partial of the canonical payment settings. Full and partial are stable kind selectors."
url: https://docs.stoqapp.com/v2-reference/preorders-offers/update-a-payment-on-an-offer/
api: "API v2 reference"
method: PATCH
path: "/preorders/offers/{id}/payments"
---

# Update a payment on an offer

`PATCH https://app.stoqapp.com/api/v2/external/preorders/offers/{id}/payments`

Update a deep partial of the canonical payment settings. Full and partial are stable kind selectors.

**Note:** Omitted fields stay unchanged. Null clears copy or price_adjustment. Explicit options_offered adds/removes kinds. Choose full or partial for ambiguous billing copy. Read-only and unknown fields are rejected. Invalid patches write nothing locally; publication runs after commit.

## Path parameters

- `id` (string, required)

## Headers

- `Idempotency-Key` (string): A fresh unique key for every write (a new UUID, say); reuse it only to retry that write. Keys are remembered for 1 hour: the same key and the same request within that hour returns the first result, with `Idempotent-Replayed: true`, without running again; the same key with a different method, path or body is refused (422 `idempotency_key_reused`); a retry while the first is still running gets 409 `idempotency_key_in_progress`. Keys are per store. Server errors and rate limits are not kept, so their retry runs.

## Request body

- `options_offered` (string): Explicitly add or remove full/partial payment kinds. Omitted kinds remain offered. Mode changes initialize payment widget and cart attributes. One of: `full`, `partial`, `full_and_partial`.
- `default_option` (string): Select an offered, synced full or partial kind as the default. One of: `full`, `partial`.
- `full` (object)
  - `option_title` (string, nullable): Billing Title for full payment.
  - `option_description` (string, nullable): Billing Description for full payment.
  - `discount_text` (string, nullable): Discount copy for full payment.
  - `price_adjustment` (object, nullable): e.g. `string`
    - `adjustment_type` (string, nullable): Percentage or fixed amount discount. Null clears the discount. One of: `percentage`, `price`, `fixed_amount`, `null`.
    - `adjustment_amount` (number, nullable): Discount amount; an omitted type uses the saved type.
- `partial` (object)
  - `option_title` (string, nullable): Billing Title for partial payment.
  - `option_description` (string, nullable): Billing Description for partial payment.
  - `discount_text` (string, nullable): Discount copy for partial payment.
  - `price_adjustment` (object, nullable): e.g. `string`
    - `adjustment_type` (string, nullable): Percentage or fixed amount discount. Null clears the discount. One of: `percentage`, `price`, `fixed_amount`, `null`.
    - `adjustment_amount` (number, nullable): Discount amount; an omitted type uses the saved type.
  - `checkout_charge` (object)
    - `charge_type` (string): Deposit as percentage or price. One of: `percentage`, `price`.
    - `charge_amount` (number): Checkout deposit; percentage must not exceed 100. 0 is the editor's &quot;No upfront payment&quot;: nothing is charged at checkout.
  - `remaining_balance` (object)
    - `charge_trigger` (string): Collect at an exact time or days after checkout. One of: `exact_time`, `time_after_checkout`.
    - `charge_exact_time` (string, nullable): ISO 8601 datetime, required for exact_time; otherwise null.
    - `days_after_checkout` (integer, nullable): Positive days, required for time_after_checkout; otherwise null.
- `collection_schedule` (string): Collect the remaining balance manually, on its scheduled date, or on fulfillment. A balance due date alone charges nothing: &quot;charge the rest after N days&quot; also needs scheduled, and while it stays manual say the merchant collects it. One of: `manual`, `scheduled`, `on_fulfillment`.
- `show_payment_widget` (boolean): Show payment &amp; discount savings. Also turns the payment cart attribute (advanced.cart_attributes.show_payment) on or off, as the editor does.
- `show_discounted_price` (boolean): Show discounted price.
- `locale` (string): Language the translated fields are written in, such as 'fr' or 'pt-BR'. Omitted: the shop's default language. Untranslated fields ignore it.

Rate limit: this call costs 2 points ([rate limits](https://docs.stoqapp.com/docs/rate-limits/)).

## Example request

```sh
curl -X PATCH "https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/payments" \
  -H "X-Auth-Token: $STOQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "options_offered": "full",
    "default_option": "full",
    "full": {
      "option_title": "string",
      "option_description": "string",
      "discount_text": "Preorder now",
      "price_adjustment": "string"
    },
    "partial": {
      "option_title": "string",
      "option_description": "string",
      "discount_text": "Preorder now",
      "price_adjustment": "string",
      "checkout_charge": {
        "charge_type": "percentage",
        "charge_amount": 0
      },
      "remaining_balance": {
        "charge_trigger": "exact_time",
        "charge_exact_time": "string",
        "days_after_checkout": "string"
      }
    },
    "collection_schedule": "manual",
    "show_payment_widget": true,
    "show_discounted_price": 5,
    "locale": "fr"
  }'
```

## 200

Success: the updated resource.

## 202

Saved. Returns the updated section, with also_changed for cascades.

## 401

Missing or invalid `X-Auth-Token`.

```json
{
  "errors": [
    "Invalid API key"
  ],
  "code": "auth_invalid",
  "details": [
    {
      "code": "auth_invalid",
      "message": "Invalid API key",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 404

The resource does not exist for this shop, or the action path is not registered.

```json
{
  "errors": [
    "Offer not found"
  ],
  "code": "not_found",
  "details": [
    {
      "code": "not_found",
      "message": "Offer not found",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 409

An earlier request with the same Idempotency-Key is still running. Wait, then resend the same request with the same key.

```json
{
  "errors": [
    "A request with this Idempotency-Key is still running"
  ],
  "code": "idempotency_key_in_progress",
  "details": [
    {
      "code": "idempotency_key_in_progress",
      "message": "A request with this Idempotency-Key is still running",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 422

Invalid fields: one `details` entry per field error, its `path` the canonical section path. Nothing was saved.

```json
{
  "errors": [
    "widget.button.text_color must be a hex color"
  ],
  "code": "invalid_params",
  "details": [
    {
      "code": "invalid_params",
      "message": "must be a hex color",
      "path": "widget.button.text_color",
      "value": "blue",
      "expected": {
        "type": "string"
      }
    }
  ]
}
```

## 429

Rate limited: cost-weighted per token (read 1, write 2; 360 points / 60s). Check `Retry-After`.

```json
{
  "errors": [
    "Rate limit exceeded"
  ],
  "code": "rate_limited",
  "details": [
    {
      "code": "rate_limited",
      "message": "Rate limit exceeded",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

