> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cabrapi.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Payment

> Learn how to update payments using the endpoint PUT /stores/{storeId}/payments/{paymentId}.

## 📌 Endpoint

`PUT /stores/{storeId}/payments/{paymentId}`

Updates the shipment (`shipment`) and/or `metadata` of an approved payment.

***

## 🔐 Authentication

* **Private route**.
* Requires header `Authorization` with your API key and active plan.

```json theme={null}
{
	"Authorization": "YOUR_API_KEY_HERE"
}
```

***

## 🧾 Route parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `storeId` | string | Yes | Store ID |
| `paymentId` | string | Yes | Payment ID |

***

## 🧍 Body (JSON)

| Field | Type | Required | Rules |
| - | - | - | - |
| `shipment` | string | No | `PENDING`, `PREPARING`, `SHIPPED`, `DELIVERED`, `RETURNED`, `CANCELLED` |
| `metadata` | object | No | object up to 999 |

***

## ✅ Example request

```bash theme={null}
curl -X PUT "https://api.cabrapi.com.br/v1/stores/STORE_ID/payments/PAYMENT_ID" \
	-H "Authorization: YOUR_API_KEY_HERE" \
	-H "Content-Type: application/json" \
	-d '{ "shipment": "SHIPPED" }'
```

***

## Standard snippet (cURL)

Use the cURL example from the Request example section above as the official snippet.

***

## 📦 Success response (200)

```json theme={null}
{
	"code": "PAYMENT_UPDATED",
	"payment": {
		"id": "PAYMENT_ID",
		"uuid": "8cf7de6e-4c92-4baf-b978-2f9195f2e0e2",
		"status": "APPROVED",
		"name": "João da Silva",
		"email": "joao@email.com",
		"cpf": "12345678909",
		"price": 49.9,
		"coupon": true,
		"gateway": "MERCADOPAGO",
		"shipment": "SHIPPED",
		"metadata": {
			"items": [
				{
					"product": {
						"id": "PRODUCT_ID",
						"name": "Curso de Marketing",
						"position": 1,
						"description": "Aprenda marketing digital",
						"price": 49.9,
						"image": "https://cdn.cabrapi.com.br/imagem.jpg",
						"delivery": "DIGITAL",
						"stock": 100,
						"sold": 1,
						"storeId": "STORE_ID",
						"disabled": false,
						"metadata": {},
						"createdAt": "2026-01-01T10:00:00Z",
						"updatedAt": "2026-01-01T10:00:00Z",
						"categories": []
					},
					"quantity": 1,
					"price": 44.91,
					"coupon": "BEMVINDO10",
					"billingCycleMonths": null
				}
			]
		},
		"affiliateCode": null,
		"storeId": "STORE_ID",
		"createdAt": "2026-09-08T19:30:00Z",
		"updatedAt": "2026-09-08T19:35:00Z",
		"products": [
			{
				"id": "PRODUCT_ID",
				"name": "Curso de Marketing",
				"price": 49.9,
				"image": "https://cdn.cabrapi.com.br/imagem.jpg",
				"description": "Aprenda marketing digital"
			}
		],
		"affiliateCommission": null
	}
}
```

***

## ⚠️ Possible errors

* `400 INVALID_DATA` → invalid body/parameters
* `401 API_KEY_NOT_PROVIDED` → missing `Authorization` header
* `401 INVALID_API_KEY` → invalid API key
* `401 UNAUTHENTICATED` → unauthenticated user
* `403 USER_DISABLED` → user disabled or deleted
* `403 NO_ACTIVE_SUBSCRIPTION` → inactive or expired plan
* `403 UPDATE_NOT_ALLOWED` → payment is not approved
* `404 STORE_NOT_FOUND` → store not found
* `404 PAYMENT_NOT_FOUND` → payment not found
* `429 RATE_LIMIT_EXCEEDED` → plan per-minute rate limit exceeded
* `500 INTERNAL_SERVER_ERROR` → internal error
* `503 SERVICE_UNAVAILABLE` → service temporarily unavailable


## OpenAPI

````yaml PUT /stores/{storeId}/payments/{paymentId}
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /stores/{storeId}/payments/{paymentId}:
    put:
      tags:
        - Payments
      summary: Update payment
      operationId: updatePayment
      parameters:
        - $ref: '#/components/parameters/StoreId'
        - $ref: '#/components/parameters/PaymentId'
      requestBody:
        required: false
        description: Payment fields to update.
        content:
          application/json:
            schema:
              type: object
              properties:
                shipment:
                  enum:
                    - PENDING
                    - PREPARING
                    - SHIPPED
                    - DELIVERED
                    - RETURNED
                    - CANCELLED
                  type: string
                metadata:
                  type: object
                  maxProperties: 999
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: PAYMENT_UPDATED
                    type: string
                  payment:
                    $ref: '#/components/schemas/Payment'
                required:
                  - code
                  - payment
                type: object
          description: Update payment.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid API key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden (inactive plan or insufficient permissions).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Rate limit exceeded.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Service unavailable.
      security:
        - ApiKey: []
components:
  parameters:
    StoreId:
      in: path
      name: storeId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
    PaymentId:
      in: path
      name: paymentId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
  schemas:
    Payment:
      description: Store payment/charge.
      properties:
        affiliateCode:
          nullable: true
          type: string
        affiliateCommission:
          nullable: true
          type: object
          properties:
            code:
              type: string
            name:
              type: string
            email:
              nullable: true
              type: string
            value:
              type: number
          required:
            - code
            - name
            - value
        coupon:
          type: boolean
        cpf:
          nullable: true
          type: string
        createdAt:
          format: date-time
          type: string
        email:
          format: email
          type: string
        gateway:
          type: string
        id:
          format: uuid
          type: string
        metadata:
          nullable: true
          type: object
        name:
          type: string
        price:
          type: number
        products:
          items:
            properties:
              description:
                nullable: true
                type: string
              id:
                format: uuid
                type: string
              image:
                nullable: true
                type: string
              name:
                type: string
              price:
                type: number
            required:
              - id
              - name
              - price
            type: object
          type: array
        shipment:
          enum:
            - PENDING
            - PREPARING
            - SHIPPED
            - DELIVERED
            - RETURNED
            - CANCELLED
          type: string
        status:
          enum:
            - PENDING
            - APPROVED
            - REJECTED
            - CANCELLED
            - REFUNDED
            - CHARGED_BACK
            - EXPIRED
          type: string
        storeId:
          format: uuid
          type: string
        updatedAt:
          format: date-time
          type: string
        uuid:
          format: uuid
          type: string
      required:
        - id
        - uuid
        - status
        - name
        - email
        - price
        - coupon
        - gateway
        - shipment
        - storeId
        - createdAt
        - updatedAt
        - products
      type: object
    Error:
      properties:
        code:
          example: STORE_NOT_FOUND
          type: string
      required:
        - code
      type: object
  securitySchemes:
    ApiKey:
      in: header
      name: Authorization
      type: apiKey
      x-default: YOUR_API_KEY_HERE

````

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