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

# Update purchase

> Changes the payment, order or shipping status (or the order number) of a purchase created with POST /v1/purchases. Only what you send changes. Marking it paid counts the purchase as a sale and adds it to the customer's totals; refunded or voided takes a paid purchase out of the sales and the totals. Purchases that came from a store integration can't be changed here (409 purchase_not_editable), because the store is their source. No flow is started and no message is sent. Requires a live API key (bvt_live_) with the write scope.



## OpenAPI

````yaml /openapi.en.json post /v1/purchases/{purchase_id}
openapi: 3.1.0
info:
  title: Bevits API
  version: 1.0.0
  description: >-
    Bevits public API for querying and managing CRM data, customers, purchases,
    segments, tags, automations, recipes, campaigns, email templates, brand kit,
    custom events, and webhooks.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://api.bevits.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: System
    description: API availability.
  - name: Identity
    description: Organization and API key identity.
  - name: Customers
    description: Customers and their relationships.
  - name: Segments
    description: Customer segments.
  - name: Purchases
    description: >-
      Purchases from store integrations and purchases created through the API by
      organizations that sell through their own system.
  - name: CRM data
    description: Tags and attribute definitions.
  - name: Automations
    description: Automation flows.
  - name: Campaigns
    description: Email, WhatsApp, and SMS campaigns.
  - name: Account and brand
    description: Account context, brand kit, and images.
  - name: Recipes
    description: Ready-made automations created from recipes, with undo.
  - name: Email templates
    description: Creating and importing email templates.
  - name: Events
    description: Custom events sent by the store and their types.
  - name: Webhooks
    description: Endpoints that receive the store's events, and the delivery log.
paths:
  /v1/purchases/{purchase_id}:
    post:
      tags:
        - Purchases
      summary: Update purchase
      description: >-
        Changes the payment, order or shipping status (or the order number) of a
        purchase created with POST /v1/purchases. Only what you send changes.
        Marking it paid counts the purchase as a sale and adds it to the
        customer's totals; refunded or voided takes a paid purchase out of the
        sales and the totals. Purchases that came from a store integration can't
        be changed here (409 purchase_not_editable), because the store is their
        source. No flow is started and no message is sent. Requires a live API
        key (bvt_live_) with the write scope.
      operationId: updatePurchase
      parameters:
        - $ref: '#/components/parameters/PurchaseId'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePurchaseRequest'
            example:
              payment_status: refunded
      responses:
        '200':
          $ref: '#/components/responses/PurchaseUpdated'
        '400':
          $ref: '#/components/responses/InvalidBody'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/PurchaseWriteForbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/PurchaseConflict'
        '422':
          $ref: '#/components/responses/PurchaseValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    PurchaseId:
      name: purchase_id
      in: path
      required: true
      description: Public purchase ID.
      schema:
        type: string
        pattern: ^pur_[A-Za-z0-9_-]+$
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: >-
        Unique key for the operation, 1 to 255 characters (a UUID, for example).
        Repeating the same key with the same body within 24 hours returns the
        original response instead of running it again.
      schema:
        type: string
  schemas:
    UpdatePurchaseRequest:
      type: object
      additionalProperties: false
      minProperties: 1
      description: Send at least one field. Only what you send changes.
      properties:
        payment_status:
          type: string
          enum:
            - pending
            - authorized
            - paid
            - refunded
            - voided
          description: >-
            paid counts the purchase as a sale and adds it to the customer's
            totals; refunded or voided takes a paid purchase out of the sales
            and the totals.
        status:
          type: string
          enum:
            - open
            - closed
            - cancelled
          description: The order's status in your system.
        shipping_status:
          type: string
          enum:
            - unfulfilled
            - fulfilled
            - shipped
            - delivered
        order_number:
          type: string
          minLength: 1
          maxLength: 191
          description: The order number the customer sees, such as 1042.
    Purchase:
      type: object
      required:
        - object
        - id
        - customer_id
        - purchase_value_in_cents
        - created_at
        - updated_at
      properties:
        object:
          type: string
          const: purchase
        id:
          type: string
          pattern: ^pur_[A-Za-z0-9_-]+$
        customer_id:
          type: string
          pattern: ^cus_[A-Za-z0-9_-]+$
        external_id:
          type: string
          description: >-
            The order's ID in the system it came from: the store, or your own
            system for purchases created through the API.
        order_id_on_integration_platform:
          type: string
        order_number:
          type: string
        platform:
          type: string
        status:
          type: string
        payment_status:
          type: string
        shipping_status:
          type: string
        currency:
          type: string
          example: BRL
        purchase_value_in_cents:
          type: integer
        subtotal_amount_in_cents:
          type: integer
        total_amount_in_cents:
          type: integer
        discount_in_cents:
          type: integer
        shipping_cost_customer_in_cents:
          type: integer
        coupons:
          type: array
          items:
            $ref: '#/components/schemas/Coupon'
        attributed_flow_ids:
          deprecated: true
          description: >-
            Deprecated legacy field retained for compatibility. When present,
            always returns an empty array; execution attribution is unavailable
            in this field.
          type: array
          items:
            type: string
            pattern: ^flw_[A-Za-z0-9_-]+$
        utm_source:
          type: string
        utm_medium:
          type: string
        utm_campaign:
          type: string
        utm_content:
          type: string
        utm_term:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
    RateLimitErrorResponse:
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          required:
            - retry_after
          properties:
            retry_after:
              type: integer
              minimum: 1
              description: Seconds before retrying.
    Coupon:
      type: object
      required:
        - id
        - code
        - value
        - type
      properties:
        id:
          type: string
        code:
          type: string
        value:
          type: number
        type:
          type: string
    Error:
      type: object
      required:
        - type
        - message
        - request_id
      properties:
        type:
          type: string
          enum:
            - authentication_error
            - conflict
            - internal_error
            - invalid_request
            - not_found
            - permission_denied
            - rate_limited
            - service_unavailable
            - validation_error
        code:
          type: string
          description: >-
            Stable, machine-readable reason within type, such as
            invalid_event_name. Present when the error has a named reason.
        message:
          type: string
        param:
          type: string
          description: >-
            Full path of the offending field, such as customer.email or
            events[3].name.
        suggestion:
          type: string
          description: A value that would be accepted, when there is an obvious one.
        request_id:
          type: string
          pattern: ^req_[a-f0-9]{24}$
  responses:
    PurchaseUpdated:
      description: Purchase updated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Purchase'
          example:
            object: purchase
            id: pur_ckabc123
            customer_id: cus_ckabc123
            external_id: ord_77120
            order_id_on_integration_platform: ord_77120
            order_number: '10293'
            platform: api
            status: open
            payment_status: refunded
            currency: BRL
            purchase_value_in_cents: 17990
            subtotal_amount_in_cents: 17990
            total_amount_in_cents: 18990
            shipping_cost_customer_in_cents: 1000
            coupons: []
            created_at: '2026-11-24T14:00:00.000Z'
            updated_at: '2026-11-25T10:30:00.000Z'
    InvalidBody:
      description: >-
        Missing request body, a body that is not a JSON object, or an invalid
        route parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, expired, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: authentication_error
              message: Invalid API key.
              request_id: req_07f6cdc3c20249d6afcd90b4
    PurchaseWriteForbidden:
      description: >-
        The API key does not have the write scope, or it is a test key
        (bvt_test_): purchases have no test mode, because they would count as
        real sales.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: permission_denied
              code: test_mode_not_supported
              message: >-
                Purchases can't be written with a test key: they would count as
                real sales. Use a live key (bvt_live_…).
              request_id: req_07f6cdc3c20249d6afcd90b4
    NotFound:
      description: Resource does not exist or belongs to another organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    PurchaseConflict:
      description: >-
        The purchase came from a store integration, which is its source, and
        can't be changed through the API (purchase_not_editable), or the
        Idempotency-Key was already used with a different request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: conflict
              code: purchase_not_editable
              message: >-
                Only purchases created through the API can be changed here; this
                one comes from a store integration, which is its source.
              param: purchase_id
              request_id: req_07f6cdc3c20249d6afcd90b4
    PurchaseValidationError:
      description: >-
        Missing required field, unknown field, invalid amount or currency,
        customer without an identifier, customer with an e-mail on a domain
        reserved for testing (test_customer_not_supported), created_at more than
        1 hour in the future (created_at_in_future) or before 2000-01-01
        (created_at_too_old) or, on an update, no field to change.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: validation_error
              code: created_at_in_future
              message: >-
                created_at is in the future. Send when the order was placed, or
                omit it for now.
              param: created_at
              request_id: req_07f6cdc3c20249d6afcd90b4
    RateLimited:
      description: Request limit exceeded.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitErrorResponse'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  headers:
    RetryAfter:
      description: Seconds before retrying.
      schema:
        type: integer
        minimum: 1
    RateLimitLimit:
      description: Total limit for the current window.
      schema:
        type: integer
        example: 600
    RateLimitRemaining:
      description: Requests remaining in the current window.
      schema:
        type: integer
        example: 599
    RateLimitReset:
      description: UTC instant when the current window ends.
      schema:
        type: string
        format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: bvt_live_...
      description: API key created in the organization settings.

````

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