Pagar.me Subscriptions API

Recurring billing agreements.

Documentation

Specifications

Other Resources

OpenAPI Specification

pagarme-subscriptions-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Pagar.me Core Anticipations Subscriptions 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: Subscriptions
  description: Recurring billing agreements.
paths:
  /subscriptions:
    post:
      operationId: createSubscription
      tags:
      - Subscriptions
      summary: Create subscription
      description: Creates a recurring subscription, either from a plan (plan_id) or standalone with inline items and interval.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriptionRequest'
      responses:
        '200':
          description: The created subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
    get:
      operationId: listSubscriptions
      tags:
      - Subscriptions
      summary: List subscriptions
      parameters:
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/Size'
      responses:
        '200':
          description: A list of subscriptions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionList'
  /subscriptions/{subscription_id}:
    get:
      operationId: getSubscription
      tags:
      - Subscriptions
      summary: Get subscription
      parameters:
      - $ref: '#/components/parameters/SubscriptionId'
      responses:
        '200':
          description: The subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
    delete:
      operationId: cancelSubscription
      tags:
      - Subscriptions
      summary: Cancel subscription
      parameters:
      - $ref: '#/components/parameters/SubscriptionId'
      responses:
        '200':
          description: The cancelled subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
  /subscriptions/{subscription_id}/cycles:
    post:
      operationId: createSubscriptionCycle
      tags:
      - Subscriptions
      summary: Renew subscription cycle
      parameters:
      - $ref: '#/components/parameters/SubscriptionId'
      responses:
        '200':
          description: The created cycle
          content:
            application/json:
              schema:
                type: object
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.
    CreatePlanRequest:
      type: object
      required:
      - name
      - interval
      - interval_count
      properties:
        name:
          type: string
        description:
          type: string
        interval:
          type: string
          enum:
          - day
          - week
          - month
          - year
        interval_count:
          type: integer
        billing_type:
          type: string
          enum:
          - prepaid
          - postpaid
          - exact_day
        payment_methods:
          type: array
          items:
            type: string
            enum:
            - credit_card
            - boleto
            - pix
        installments:
          type: array
          items:
            type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/PlanItem'
        currency:
          type: string
    Plan:
      allOf:
      - $ref: '#/components/schemas/CreatePlanRequest'
      - type: object
        properties:
          id:
            type: string
          status:
            type: string
          created_at:
            type: string
            format: date-time
    SubscriptionList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
        paging:
          $ref: '#/components/schemas/Paging'
    Subscription:
      type: object
      properties:
        id:
          type: string
        code:
          type: string
        status:
          type: string
        payment_method:
          type: string
        interval:
          type: string
        interval_count:
          type: integer
        plan:
          $ref: '#/components/schemas/Plan'
        customer:
          $ref: '#/components/schemas/Customer'
        current_cycle:
          type: object
          additionalProperties: true
        created_at:
          type: string
          format: date-time
    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
    PricingScheme:
      type: object
      properties:
        scheme_type:
          type: string
          enum:
          - unit
          - package
          - volume
          - tier
        price:
          type: integer
    PlanItem:
      type: object
      properties:
        name:
          type: string
        quantity:
          type: integer
        pricing_scheme:
          $ref: '#/components/schemas/PricingScheme'
    CreateSubscriptionRequest:
      type: object
      properties:
        plan_id:
          type: string
        code:
          type: string
        payment_method:
          type: string
          enum:
          - credit_card
          - boleto
          - pix
        customer_id:
          type: string
        customer:
          $ref: '#/components/schemas/CreateCustomerRequest'
        card_id:
          type: string
        card_token:
          type: string
        interval:
          type: string
          enum:
          - day
          - week
          - month
          - year
        interval_count:
          type: integer
        billing_type:
          type: string
          enum:
          - prepaid
          - postpaid
          - exact_day
        items:
          type: array
          items:
            $ref: '#/components/schemas/PlanItem'
    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
    SubscriptionId:
      name: subscription_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.