openapi: 3.0.1 info: title: Openpay BankAccounts Charges 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: Charges description: Create and manage charges to cards, stores, and banks. paths: /{merchant_id}/charges: parameters: - $ref: '#/components/parameters/MerchantId' post: operationId: createMerchantCharge tags: - Charges summary: Create a charge at the merchant level. description: Creates a charge against a card (saved card id, token, or raw card data), a store (cash), or a bank (SPEI). For card charges, set capture=false to authorize without capturing. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateCharge' responses: '200': description: Charge created. content: application/json: schema: $ref: '#/components/schemas/Charge' '400': $ref: '#/components/responses/Error' '402': $ref: '#/components/responses/Error' get: operationId: listMerchantCharges tags: - Charges summary: List charges at the merchant level. parameters: - $ref: '#/components/parameters/Creation' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' responses: '200': description: A list of charges. content: application/json: schema: type: array items: $ref: '#/components/schemas/Charge' /{merchant_id}/charges/{transaction_id}: parameters: - $ref: '#/components/parameters/MerchantId' - $ref: '#/components/parameters/TransactionId' get: operationId: getMerchantCharge tags: - Charges summary: Get a charge by id. responses: '200': description: The charge. content: application/json: schema: $ref: '#/components/schemas/Charge' '404': $ref: '#/components/responses/Error' /{merchant_id}/charges/{transaction_id}/refund: parameters: - $ref: '#/components/parameters/MerchantId' - $ref: '#/components/parameters/TransactionId' post: operationId: refundMerchantCharge tags: - Charges summary: Refund a charge. requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/RefundRequest' responses: '200': description: The refunded charge. content: application/json: schema: $ref: '#/components/schemas/Charge' /{merchant_id}/charges/{transaction_id}/capture: parameters: - $ref: '#/components/parameters/MerchantId' - $ref: '#/components/parameters/TransactionId' post: operationId: captureMerchantCharge tags: - Charges summary: Capture a previously authorized charge. requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/CaptureRequest' responses: '200': description: The captured charge. content: application/json: schema: $ref: '#/components/schemas/Charge' /{merchant_id}/customers/{customer_id}/charges: parameters: - $ref: '#/components/parameters/MerchantId' - $ref: '#/components/parameters/CustomerId' post: operationId: createCustomerCharge tags: - Charges summary: Create a charge at the customer level. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateCharge' responses: '200': description: Charge created. content: application/json: schema: $ref: '#/components/schemas/Charge' get: operationId: listCustomerCharges tags: - Charges summary: List a customer's charges. parameters: - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' responses: '200': description: A list of charges. content: application/json: schema: type: array items: $ref: '#/components/schemas/Charge' components: parameters: Offset: name: offset in: query required: false description: Number of records to skip for pagination. schema: type: integer default: 0 TransactionId: name: transaction_id in: path required: true schema: type: string MerchantId: name: merchant_id in: path required: true description: The merchant identifier that scopes all resources. schema: type: string Creation: name: creation in: query required: false description: Filter by creation date (yyyy-mm-dd). schema: type: string format: date CustomerId: name: customer_id in: path required: true schema: type: string Limit: name: limit in: query required: false description: Maximum number of records to return. schema: type: integer default: 10 schemas: CaptureRequest: type: object properties: amount: type: number format: float description: Amount to capture, up to the authorized amount. ChargeCustomer: type: object properties: name: type: string last_name: type: string email: type: string phone_number: type: string Error: type: object properties: category: type: string enum: - request - internal - gateway description: Whether the error is in the request, internal, or at the gateway. error_code: type: integer description: Openpay-specific error code. description: type: string http_code: type: integer request_id: type: string fraud_rules: type: array items: type: string PaymentMethod: type: object description: Method-specific payment details, present for store and bank charges (e.g. reference, barcode_url, clabe, agreement, name). properties: type: type: string reference: type: string barcode_url: type: string clabe: type: string agreement: type: string name: type: string RefundRequest: type: object properties: description: type: string amount: type: number format: float description: Optional partial refund amount. CreateCharge: type: object required: - method - amount properties: method: type: string enum: - card - store - bank_account description: The payment method for the charge. source_id: type: string description: A stored card id or a token id (for card charges). amount: type: number format: float description: Charge amount in the merchant currency. currency: type: string example: MXN description: type: string order_id: type: string description: Unique merchant order identifier. device_session_id: type: string description: Anti-fraud device session id captured client-side. capture: type: boolean default: true description: Set false to authorize without capturing. customer: $ref: '#/components/schemas/ChargeCustomer' 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 Charge: type: object properties: id: type: string authorization: type: string method: type: string operation_type: type: string example: in transaction_type: type: string example: charge status: type: string enum: - completed - in_progress - failed - cancelled - refunded amount: type: number format: float currency: type: string description: type: string order_id: type: string creation_date: type: string format: date-time operation_date: type: string format: date-time card: $ref: '#/components/schemas/Card' payment_method: $ref: '#/components/schemas/PaymentMethod' error_message: type: string responses: Error: description: An Openpay error response. content: application/json: schema: $ref: '#/components/schemas/Error' securitySchemes: basicAuth: type: http scheme: basic description: HTTP Basic authentication. Use the merchant private API key as the username and leave the password empty.