openapi: 3.0.1 info: title: Openpay BankAccounts Subscriptions 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: Subscriptions description: Associate customers and cards to plans for recurring billing. paths: /{merchant_id}/customers/{customer_id}/subscriptions: parameters: - $ref: '#/components/parameters/MerchantId' - $ref: '#/components/parameters/CustomerId' post: operationId: createSubscription tags: - Subscriptions summary: Create a subscription for a customer. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSubscription' responses: '200': description: Subscription created. content: application/json: schema: $ref: '#/components/schemas/Subscription' get: operationId: listSubscriptions tags: - Subscriptions summary: List a customer's subscriptions. responses: '200': description: A list of subscriptions. content: application/json: schema: type: array items: $ref: '#/components/schemas/Subscription' /{merchant_id}/customers/{customer_id}/subscriptions/{subscription_id}: parameters: - $ref: '#/components/parameters/MerchantId' - $ref: '#/components/parameters/CustomerId' - name: subscription_id in: path required: true schema: type: string get: operationId: getSubscription tags: - Subscriptions summary: Get a subscription by id. responses: '200': description: The subscription. content: application/json: schema: $ref: '#/components/schemas/Subscription' put: operationId: updateSubscription tags: - Subscriptions summary: Update a subscription. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSubscription' responses: '200': description: The updated subscription. content: application/json: schema: $ref: '#/components/schemas/Subscription' delete: operationId: cancelSubscription tags: - Subscriptions summary: Cancel a subscription. responses: '204': description: Subscription cancelled. components: schemas: Subscription: type: object properties: id: type: string customer_id: type: string plan_id: type: string status: type: string enum: - active - trial - past_due - unpaid - cancelled cancel_at_period_end: type: boolean charge_date: type: string format: date creation_date: type: string format: date-time current_period_number: type: integer period_end_date: type: string format: date trial_end_date: type: string format: date card: $ref: '#/components/schemas/Card' CreateSubscription: type: object required: - plan_id properties: plan_id: type: string trial_end_date: type: string format: date source_id: type: string description: Stored card id or token id to charge. card: $ref: '#/components/schemas/CreateCard' CreateCard: type: object properties: card_number: type: string holder_name: type: string expiration_year: type: string expiration_month: type: string cvv2: type: string device_session_id: type: string token_id: type: string description: Provide a token id instead of raw card data. Card: type: object properties: id: type: string type: type: string enum: - debit - credit brand: type: string example: visa card_number: type: string description: Masked card number. holder_name: type: string expiration_year: type: string expiration_month: type: string bank_name: type: string bank_code: type: string creation_date: type: string format: date-time parameters: MerchantId: name: merchant_id in: path required: true description: The merchant identifier that scopes all resources. schema: type: string CustomerId: name: customer_id in: path required: true schema: type: string securitySchemes: basicAuth: type: http scheme: basic description: HTTP Basic authentication. Use the merchant private API key as the username and leave the password empty.