Openpay Plans API

Templates defining amount and frequency for recurring charges.

OpenAPI Specification

openpay-plans-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Openpay BankAccounts Plans API
  description: REST API for the Openpay online payments platform (BBVA group), available in Mexico and Colombia. Resources are scoped to a merchant under the path /v1/{merchant_id}. The API supports charges against cards, convenience stores (cash), and banks (SPEI); customers and stored cards; client-side tokens; recurring plans and subscriptions; payouts and transfers to bank accounts; commission fees; and webhook notifications. Authentication uses HTTP Basic auth with the merchant private API key as the username and an empty password.
  termsOfService: https://www.openpay.mx/terminos-y-condiciones.html
  contact:
    name: Openpay Support
    url: https://www.openpay.mx
    email: soporte@openpay.mx
  version: '1.0'
servers:
- url: https://api.openpay.mx/v1
  description: Production (Mexico)
- url: https://sandbox-api.openpay.mx/v1
  description: Sandbox (Mexico)
- url: https://api.openpay.co/v1
  description: Production (Colombia)
- url: https://sandbox-api.openpay.co/v1
  description: Sandbox (Colombia)
security:
- basicAuth: []
tags:
- name: Plans
  description: Templates defining amount and frequency for recurring charges.
paths:
  /{merchant_id}/plans:
    parameters:
    - $ref: '#/components/parameters/MerchantId'
    post:
      operationId: createPlan
      tags:
      - Plans
      summary: Create a plan.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePlan'
      responses:
        '200':
          description: Plan created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
    get:
      operationId: listPlans
      tags:
      - Plans
      summary: List plans.
      parameters:
      - $ref: '#/components/parameters/Offset'
      - $ref: '#/components/parameters/Limit'
      responses:
        '200':
          description: A list of plans.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Plan'
  /{merchant_id}/plans/{plan_id}:
    parameters:
    - $ref: '#/components/parameters/MerchantId'
    - name: plan_id
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: getPlan
      tags:
      - Plans
      summary: Get a plan by id.
      responses:
        '200':
          description: The plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
    put:
      operationId: updatePlan
      tags:
      - Plans
      summary: Update a plan.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePlan'
      responses:
        '200':
          description: The updated plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
    delete:
      operationId: deletePlan
      tags:
      - Plans
      summary: Delete a plan.
      responses:
        '204':
          description: Plan deleted.
components:
  parameters:
    Offset:
      name: offset
      in: query
      required: false
      description: Number of records to skip for pagination.
      schema:
        type: integer
        default: 0
    MerchantId:
      name: merchant_id
      in: path
      required: true
      description: The merchant identifier that scopes all resources.
      schema:
        type: string
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum number of records to return.
      schema:
        type: integer
        default: 10
  schemas:
    Plan:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        amount:
          type: number
          format: float
        currency:
          type: string
        repeat_every:
          type: integer
        repeat_unit:
          type: string
        retry_times:
          type: integer
        status:
          type: string
        status_after_retry:
          type: string
        trial_days:
          type: integer
        creation_date:
          type: string
          format: date-time
    CreatePlan:
      type: object
      required:
      - name
      - amount
      - repeat_every
      - repeat_unit
      properties:
        name:
          type: string
        amount:
          type: number
          format: float
        repeat_every:
          type: integer
          description: Interval count between charges.
        repeat_unit:
          type: string
          enum:
          - week
          - month
          - year
        retry_times:
          type: integer
        status_after_retry:
          type: string
          enum:
          - unpaid
          - cancelled
        trial_days:
          type: integer
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication. Use the merchant private API key as the username and leave the password empty.