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

# Purchase detail



## OpenAPI

````yaml /openapi.json get /api/v1/purchases/{id}
openapi: 3.1.0
info:
  title: PagAmerican Data API
  version: 1.0.0
  description: >-
    Sales analytics API for external consumers (creators and affiliates), served
    from ClickHouse in near real time.


    **Authentication:** send your API key (`pag_...`) directly in the
    `Authorization: Bearer <your_key>` header. There is no token exchange — the
    opaque key is the Bearer token itself.


    **Dates:** `from`/`to` are `YYYY-MM-DD` at 00:00:00 UTC; `from` is
    inclusive, `to` is exclusive. Max window 90 days. `/purchases` and `/orders`
    filter by **checkout initialization** (`checkoutInitializedAt`);
    `/checkouts` by load time; `/abandoned-carts` by session start; `/refunds`
    by request time.


    **Tenant scope:** you only receive your own account's data — isolation is
    enforced automatically by the key.
servers:
  - url: https://external-api-service.pagamerican.app
    description: Production
  - url: https://external-api-service.pagamerican.net
    description: Staging
security:
  - apiKey: []
tags:
  - name: purchases
    description: Purchases (creator and affiliate)
  - name: orders
    description: Orders (creator only)
  - name: products
    description: Product catalog (creator only)
  - name: offers
    description: Offer catalog (creator only)
  - name: checkouts
    description: Checkout sessions (creator only)
  - name: abandoned-carts
    description: Abandoned carts (creator only)
  - name: refunds
    description: Refunds, chargebacks and alerts (creator and affiliate)
  - name: health
    description: Service status
paths:
  /api/v1/purchases/{id}:
    get:
      tags:
        - purchases
      summary: Purchase detail
      parameters:
        - name: id
          in: path
          required: true
          description: purchase_id
          schema:
            type: integer
      responses:
        '200':
          description: Detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchaseDetail'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - apiKey: []
components:
  schemas:
    PurchaseDetail:
      allOf:
        - $ref: '#/components/schemas/Purchase'
        - type: object
          properties:
            purchaseItems:
              type: array
              items:
                type: object
              description: Line items in the purchase
            coupons:
              type: array
              items:
                type: object
              description: Applied coupons
            fees:
              type: array
              items:
                type: object
              description: Fees
            reservedAvailableAt:
              type: string
            reservedDays:
              type: integer
            reservedAmount:
              type: number
    Purchase:
      type: object
      properties:
        purchaseId:
          type: integer
          description: Purchase ID
          example: 151206
        purchaseUcode:
          type: string
          example: pur_01a0...
        orderId:
          type: integer
          description: Order ID
          example: 129156
        checkoutId:
          type: string
          example: chk_01a0...
        purchaseType:
          type: string
          description: front, upsell, order_bump, downsell
          example: front
        currency:
          type: string
          example: usd
        purchaseCreatedAt:
          type: string
          description: When the purchase was created (UTC)
        checkoutInitializedAt:
          type: string
          description: >-
            When the checkout was initialized (UTC) — column used for the
            from/to filter
        creatorName:
          type: string
        affiliateName:
          type: string
        offerCode:
          type: string
        offerName:
          type: string
        productName:
          type: string
        psp:
          type: string
          example: worldpay
        paymentMethod:
          type: string
          example: credit_card
        cardBrand:
          type: string
          example: visa
        cardLast4:
          type: string
          example: '0465'
        customerName:
          type: string
          description: (customer PII)
        customerEmail:
          type: string
          description: (customer PII)
        customerPhone:
          type: string
          description: (customer PII)
        billingAddress1:
          type: string
          description: (customer PII)
        billingAddress2:
          type: string
          description: (customer PII)
        billingCity:
          type: string
          description: (customer PII)
        billingState:
          type: string
          description: (customer PII)
        billingCountry:
          type: string
          description: (customer PII)
        billingZipcode:
          type: string
          description: (customer PII)
        amountTransaction:
          type: number
        amountItemsGross:
          type: number
        amountItemsNet:
          type: number
        amountShippingNet:
          type: number
        amountTaxes:
          type: number
        amountAffiliation:
          type: number
        amountAffiliationNet:
          type: number
        amountRefunded:
          type: number
        incomingAvailableAt:
          type: string
        incomingDays:
          type: integer
        amountCreatorNet:
          type: number
          description: Creator net — creator keys only
        amountCreatorPlatformFee:
          type: number
          description: Creator keys only
        amountCreatorTax:
          type: number
          description: Creator keys only
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_request
            message:
              type: string
              example: from must be before to
            correlation_id:
              type: string
              example: a1b2c3d4-...
  responses:
    BadRequest:
      description: Invalid parameters (malformed dates, from > to)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, or revoked key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Insufficient scope or persona not allowed for this resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Record not found for your tenant
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Your opaque API key (`pag_...`) sent directly as the Bearer token. There
        is no token/JWT exchange.

````