Back to API

Payments API โ€” SDK & Exports

v1.0 ยท 4 endpoints

OpenAPI 3.0 Specification
Download JSON
{
    "openapi": "3.0.3",
    "info": {
        "title": "Payments API",
        "description": "Process credit card payments, refunds and transfers with a single unified API. PCI DSS Level 1 compliant.",
        "version": "1.0"
    },
    "servers": [
        {
            "url": "https://api.aikdata.com/v1/payments"
        }
    ],
    "paths": {
        "/charge": {
            "post": {
                "operationId": "postCreateCharge",
                "summary": "Create a new payment charge",
                "tags": [
                    "Charges"
                ],
                "description": "Charges a credit card or bank account. Amount is in cents.",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "amount": {
                                        "type": "integer",
                                        "description": "Amount in cents",
                                        "example": 1500
                                    },
                                    "currency": {
                                        "type": "string",
                                        "description": "ISO 4217 currency code",
                                        "example": "USD"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Charge description",
                                        "example": "Order #1234"
                                    },
                                    "metadata": {
                                        "type": "object",
                                        "description": "Additional key-value pairs",
                                        "example": {
                                            "order_id": "ORD-1234",
                                            "channel": "playground"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "example": {
                                    "id": "ch_abc123",
                                    "amount": 1500,
                                    "currency": "USD",
                                    "status": "succeeded",
                                    "created_at": "2026-03-12T10:00:00Z"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "example": {
                                    "error": {
                                        "code": "card_declined",
                                        "message": "The card was declined."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                }
            }
        },
        "/charge/{id}": {
            "get": {
                "operationId": "getGetCharge",
                "summary": "Retrieve a charge by ID",
                "tags": [
                    "Charges"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Charge identifier returned by Create Charge"
                    }
                ],
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "example": {
                                    "id": "ch_abc123",
                                    "amount": 1500,
                                    "currency": "USD",
                                    "status": "succeeded"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                }
            }
        },
        "/charges": {
            "get": {
                "operationId": "getListCharges",
                "summary": "List all charges with pagination",
                "tags": [
                    "Charges"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Results per page",
                        "example": 20
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 0
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "succeeded"
                    }
                ],
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": "ch_abc123",
                                            "amount": 1500,
                                            "status": "succeeded"
                                        }
                                    ],
                                    "total": 42,
                                    "limit": 20,
                                    "offset": 0
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                }
            }
        },
        "/refund": {
            "post": {
                "operationId": "postCreateRefund",
                "summary": "Refund a charge fully or partially",
                "tags": [
                    "Refunds"
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "charge_id": {
                                        "type": "string",
                                        "example": "ch_replace_with_create_charge_id"
                                    },
                                    "amount": {
                                        "type": "integer",
                                        "description": "Partial refund amount in cents (omit for full)",
                                        "example": 1500
                                    },
                                    "reason": {
                                        "type": "string",
                                        "example": "requested_by_customer"
                                    },
                                    "metadata": {
                                        "type": "object",
                                        "description": "Additional key-value pairs",
                                        "example": {
                                            "ticket": "SUP-1001"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "example": {
                                    "id": "rf_xyz789",
                                    "charge_id": "ch_abc123",
                                    "amount": 1500,
                                    "status": "succeeded"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT"
            }
        }
    }
}