Pagar.me Charges API

Individual payment attempts generated by an order.

Documentation

Specifications

Other Resources

OpenAPI Specification

pagarme-charges-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Pagar.me Core Anticipations Charges API
  description: The Pagar.me Core API (v5) is a REST API for online payments in Brazil. It processes orders and charges via credit card, PIX, and boleto; manages customers, addresses, cards, and tokens; supports recurring billing through plans, subscriptions, and invoices; and provides marketplace capabilities via recipients, split, transfers, and anticipations, with webhook event notifications. Authentication uses HTTP Basic auth with the account secret key as the username and an empty password.
  termsOfService: https://pagar.me/termos-de-uso/
  contact:
    name: Pagar.me Support
    url: https://docs.pagar.me
  version: '5'
servers:
- url: https://api.pagar.me/core/v5
  description: Pagar.me Core API v5 production
security:
- basicAuth: []
tags:
- name: Charges
  description: Individual payment attempts generated by an order.
paths:
  /charges/{charge_id}:
    get:
      operationId: getCharge
      tags:
      - Charges
      summary: Get charge
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      responses:
        '200':
          description: The charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
    delete:
      operationId: cancelCharge
      tags:
      - Charges
      summary: Cancel or refund a charge
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      responses:
        '200':
          description: The cancelled charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
  /charges:
    get:
      operationId: listCharges
      tags:
      - Charges
      summary: List charges
      parameters:
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/Size'
      responses:
        '200':
          description: A list of charges
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChargeList'
  /charges/{charge_id}/capture:
    post:
      operationId: captureCharge
      tags:
      - Charges
      summary: Capture a charge
      description: Captures a previously authorized credit card charge.
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: integer
                  description: Amount to capture in cents.
      responses:
        '200':
          description: The captured charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
  /charges/{charge_id}/card:
    patch:
      operationId: updateChargeCard
      tags:
      - Charges
      summary: Update charge card
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                card_id:
                  type: string
                card_token:
                  type: string
      responses:
        '200':
          description: The updated charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
  /charges/{charge_id}/payment-method:
    patch:
      operationId: updateChargePaymentMethod
      tags:
      - Charges
      summary: Update charge payment method
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                payment_method:
                  type: string
                  enum:
                  - credit_card
                  - boleto
                  - pix
                update_subscription:
                  type: boolean
      responses:
        '200':
          description: The updated charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
components:
  schemas:
    Address:
      type: object
      properties:
        line_1:
          type: string
        line_2:
          type: string
        zip_code:
          type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
          description: ISO 3166-1 alpha-2 country code.
    Customer:
      allOf:
      - $ref: '#/components/schemas/CreateCustomerRequest'
      - type: object
        properties:
          id:
            type: string
          created_at:
            type: string
            format: date-time
    Phone:
      type: object
      properties:
        country_code:
          type: string
        area_code:
          type: string
        number:
          type: string
    Charge:
      type: object
      properties:
        id:
          type: string
        code:
          type: string
        amount:
          type: integer
        paid_amount:
          type: integer
        status:
          type: string
          enum:
          - pending
          - paid
          - canceled
          - processing
          - failed
          - overpaid
          - underpaid
        currency:
          type: string
        payment_method:
          type: string
        order_id:
          type: string
        customer:
          $ref: '#/components/schemas/Customer'
        last_transaction:
          type: object
          additionalProperties: true
        created_at:
          type: string
          format: date-time
    ChargeList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Charge'
        paging:
          $ref: '#/components/schemas/Paging'
    Paging:
      type: object
      properties:
        total:
          type: integer
        page:
          type: integer
        size:
          type: integer
    CreateCustomerRequest:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
        document:
          type: string
          description: CPF or CNPJ.
        document_type:
          type: string
          enum:
          - CPF
          - CNPJ
          - PASSPORT
        type:
          type: string
          enum:
          - individual
          - company
        phones:
          type: object
          properties:
            home_phone:
              $ref: '#/components/schemas/Phone'
            mobile_phone:
              $ref: '#/components/schemas/Phone'
        address:
          $ref: '#/components/schemas/Address'
  parameters:
    Page:
      name: page
      in: query
      schema:
        type: integer
        default: 1
    Size:
      name: size
      in: query
      schema:
        type: integer
        default: 10
    ChargeId:
      name: charge_id
      in: path
      required: true
      schema:
        type: string
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic auth with the account secret key as the username and an empty password.