### cURL Authentication Example Source: https://korepay.readme.io/reference/index Illustrates how to make an authenticated API request using cURL. This command-line example shows the construction of the Authorization header with Base64 encoded credentials and setting the content type and data payload for a POST request. ```bash curl -X POST \ https://api.korepay.com.br/functions/v1/transactions \ -H "Authorization: Basic $(echo -n 'SECRET_KEY:COMPANY_ID' | base64)" \ -H "Content-Type: application/json" \ -d '{"data": "example"}' ``` -------------------------------- ### PHP Authentication Header Example Source: https://korepay.readme.io/reference/index Provides an example of setting up Basic Authentication headers in PHP for API requests. It shows how to encode credentials and configure cURL options for sending the authorization header and JSON payload. This is useful for PHP-based applications. ```php "example" ]); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.korepay.com.br/functions/v1/transactions", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($httpCode === 200) { $result = json_decode($response, true); // Processar resposta } else { // Tratar erro echo "Erro na requisição: " . $httpCode; } ?> ``` -------------------------------- ### Node.js Authentication Header Example Source: https://korepay.readme.io/reference/index Demonstrates how to construct the Authorization header for Basic Authentication in Node.js using a Secret Key and Company ID. It involves encoding credentials to Base64 and setting them in the request headers. This snippet is suitable for server-side integrations. ```javascript const secretKey = "sua_secret_key_aqui"; const companyId = "seu_company_id_aqui"; const credentials = Buffer.from(`${secretKey}:${companyId}`).toString("base64"); const options = { method: "POST", url: "https://api.korepay.com.br/functions/v1/transactions", headers: { "Authorization": `Basic ${credentials}`, "Content-Type": "application/json" }, }; ``` -------------------------------- ### Error Responses Source: https://korepay.readme.io/reference/delete_transactions-id This section outlines the common error responses returned by the Korepay API, including their structure and example payloads. ```APIDOC ## Error Responses ### Description Common error formats returned by the API. ### Responses #### Bad Request (400) - **error** (object) - Contains error details. - **code** (string) - Error code (e.g., "BAD_REQUEST"). - **message** (string) - Human-readable error message. - **details** (array) - Array of specific error details. ##### Example ```json { "error": { "code": "BAD_REQUEST", "message": "A requisição contém parâmetros inválidos", "details": [ "O campo 'amount' deve ser um número inteiro" ] } } ``` #### Not Found (404) - **error** (object) - Contains error details. - **code** (string) - Error code (e.g., "NOT_FOUND"). - **message** (string) - Human-readable error message. ##### Example ```json { "error": { "code": "NOT_FOUND", "message": "Transação não encontrada" } } ``` #### Validation Error (422) - **error** (object) - Contains error details. - **code** (string) - Error code (e.g., "VALIDATION_ERROR"). - **message** (string) - Human-readable error message. - **details** (array) - Array of specific validation errors. ##### Example ```json { "error": { "code": "VALIDATION_ERROR", "message": "Dados de entrada inválidos", "details": [ "O e-mail deve ter um formato válido", "O valor mínimo é R$ 1,00" ] } } ``` #### Internal Server Error (500) - **error** (object) - Contains error details. - **code** (string) - Error code (e.g., "INTERNAL_ERROR"). - **message** (string) - Human-readable error message. ##### Example ```json { "error": { "code": "INTERNAL_ERROR", "message": "Ocorreu um erro interno. Tente novamente em alguns instantes." } } ``` ``` -------------------------------- ### GET /transactions/{id} Source: https://korepay.readme.io/reference/get_transactions-id Retrieves the full details of a specific transaction using its unique ID. This endpoint supports fetching details for Pix, credit card, and boleto payments. ```APIDOC ## GET /transactions/{id} ### Description Obtém os detalhes completos de uma transação específica pelo ID. ### Method GET ### Endpoint /transactions/{id} ### Parameters #### Path Parameters - **id** (string) - Required - ID único da transação ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **response** (oneOf) - Detalhes da transação retornados com sucesso. Pode ser: - PixPaymentResponse - CardPaymentResponse - BoletoPaymentResponse #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### KorePay Gateway API Authentication Source: https://korepay.readme.io/reference/index Details on how to authenticate with the KorePay Gateway API using Basic Authentication with Secret Key and Company ID. ```APIDOC ## Authentication ### Authentication Method: Authorization Basic To access the API, use **Authorization Basic** with the following credentials: * **Username**: Secret Key * **Password**: Company ID ### How to Obtain Credentials 1. Access the gateway dashboard. 2. Navigate to **Integrations → API Keys**. 3. Copy the **Secret Key** (to be used as username). 4. Copy the **Company ID** (to be used as password). ### Authentication Implementation When making requests, include the credentials in the HTTP header `Authorization` using Basic Authentication: #### Header Format: ``` Authorization: Basic {base64_encoded_credentials} ``` Where `{base64_encoded_credentials}` is the Base64 encoding of the string `{SECRET_KEY}:{COMPANY_ID}`. #### Example in Node.js: ```typescript const secretKey = "your_secret_key_here"; const companyId = "your_company_id_here"; const credentials = Buffer.from(`${secretKey}:${companyId}`).toString("base64"); const options = { method: "POST", url: "https://api.korepay.com.br/functions/v1/transactions", headers: { "Authorization": `Basic ${credentials}`, "Content-Type": "application/json" }, }; ``` #### Example in PHP: ```php "example" ]); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.korepay.com.br/functions/v1/transactions", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($httpCode === 200) { $result = json_decode($response, true); // Process response } else { // Handle error echo "Request error: " . $httpCode; } ?> ``` #### Example in cURL: ```bash curl -X POST \ https://api.korepay.com.br/functions/v1/transactions \ -H "Authorization: Basic $(echo -n 'SECRET_KEY:COMPANY_ID' | base64)" \ -H "Content-Type: application/json" \ -d '{"data": "example"}' ``` ### Authentication Error Handling In case of invalid credentials, the API will return: * **Status Code**: `401 Unauthorized` * **Response**: ```text Unauthorized ``` ``` -------------------------------- ### KorePay Gateway API Base Endpoints and Resources Source: https://korepay.readme.io/reference/index Information about the base URL for the KorePay Gateway API and the available resources, such as Transactions. ```APIDOC ## Base Endpoints The base URL for the API is: ``` https://api.korepay.com.br/functions/v1 ``` ## Available Resources Our API offers the following main resources: * **Transactions**: Complete management of transactions (creation, listing, searching, and updating). For more details on each endpoint, consult the full API documentation. ``` -------------------------------- ### KorePay Gateway API Security Considerations Source: https://korepay.readme.io/reference/index Important security guidelines for handling API credentials to protect sensitive information. ```APIDOC ## Security Considerations * **Never** expose your credentials (Secret Key and Company ID) in client-side code. * Keep your credentials secure and do not share them. * Always use HTTPS for all requests. ``` -------------------------------- ### Authentication - Basic Authorization Source: https://korepay.readme.io/reference/introdu%C3%A7%C3%A3o Details on how to authenticate with the KorePay API using Basic Authorization with your Secret Key and Company ID. ```APIDOC ## Authentication - Basic Authorization ### Description Authenticates requests to the KorePay API using HTTP Basic Authentication. ### Method Authorization Header ### Parameters #### Request Headers - **Authorization** (string) - Required - `Basic {base64_encoded_credentials}` - Where `{base64_encoded_credentials}` is the Base64 encoding of `SECRET_KEY:COMPANY_ID`. ### Request Example (cURL) ```bash curl -X POST \ https://api.korepay.com.br/functions/v1/transactions \ -H "Authorization: Basic $(echo -n 'YOUR_SECRET_KEY:YOUR_COMPANY_ID' | base64)" \ -H "Content-Type: application/json" \ -d '{"data": "example"}' ``` ### Response #### Error Response (401 Unauthorized) - **Status Code**: `401 Unauthorized` - **Response Body**: `Unauthorized` ``` -------------------------------- ### Incluir Biblioteca de Tokenização KorePay Source: https://korepay.readme.io/reference/tokeniza%C3%A7%C3%A3o-de-cart%C3%A3o-de-cr%C3%A9dito Adiciona a biblioteca JavaScript de tokenização KorePay ao cabeçalho de uma página HTML. Esta biblioteca é necessária para gerar tokens de cartão de crédito. ```html ``` -------------------------------- ### Base URL Source: https://korepay.readme.io/reference/introdu%C3%A7%C3%A3o The base URL for all KorePay API endpoints. ```APIDOC ## Base URL ### Description The base URL for all KorePay API requests. ### Endpoint `https://api.korepay.com.br/functions/v1` ``` -------------------------------- ### Transactions API Source: https://korepay.readme.io/reference/introdu%C3%A7%C3%A3o Manage your transactions through the KorePay API, including creation, listing, retrieval, and updates. ```APIDOC ## Transactions ### Description Endpoints for managing financial transactions within the KorePay system. ### Method POST, GET, PUT, DELETE ### Endpoint `/transactions` ### Parameters #### Path Parameters - **id** (string) - Optional - The unique identifier for a transaction. #### Query Parameters - **limit** (integer) - Optional - Number of results to return. - **offset** (integer) - Optional - Number of results to skip. #### Request Body (Create Transaction) - **amount** (integer) - Required - The transaction amount in cents. - **currency** (string) - Required - The currency code (e.g., BRL). - **customer_id** (string) - Required - The ID of the customer associated with the transaction. - **metadata** (object) - Optional - Additional data to associate with the transaction. ### Request Example (Create Transaction) ```json { "amount": 10000, "currency": "BRL", "customer_id": "cust_12345", "metadata": { "order_id": "order_abcde" } } ``` ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier for the transaction. - **amount** (integer) - The transaction amount in cents. - **currency** (string) - The currency code. - **status** (string) - The current status of the transaction (e.g., 'pending', 'completed', 'failed'). - **created_at** (string) - Timestamp of when the transaction was created. - **updated_at** (string) - Timestamp of when the transaction was last updated. #### Response Example (Get Transaction) ```json { "id": "txn_abcdef123456", "amount": 10000, "currency": "BRL", "status": "completed", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:05:00Z" } ``` ``` -------------------------------- ### Gerar Token de Cartão de Crédito com KorePay Source: https://korepay.readme.io/reference/tokeniza%C3%A7%C3%A3o-de-cart%C3%A3o-de-cr%C3%A9dito Gera um token de cartão de crédito seguro usando a biblioteca KorePay JavaScript. Requer a publicKey e os dados do cartão (número, nome do titular, mês/ano de expiração e CVV). O token gerado é um identificador para o cartão. ```typescript KorePay.setPublicKey("publicKey"); var token_id = await KorePay.encrypt({ number: "4111111111111111", holderName: "João Silva", expMonth: 1, expYear: 2026, cvv: "456" }); ``` -------------------------------- ### Estrutura do Payload de Webhook em JSON Source: https://korepay.readme.io/reference/eventos-e-webhooks Este é o formato JSON base para os payloads de eventos de webhook enviados pela Korepay. Ele contém informações detalhadas sobre a transação, incluindo identificadores, valores, status, dados do cliente e detalhes de pagamento. ```json { "id": "F92XRTVSGB2B", "type": "transaction", "objectId": "28a65292-6c74-4368-924d-f52a653706be", "data": { "id": "28a65292-6c74-4368-924d-f52a653706be", "amount": 10000, "refundedAmount": null, "description": "Transação criada via API", "companyId": "6b366424-d046-41c6-8976-22a516f7dfb8", "installments": 1, "paymentMethod": "PIX", "status": "paid", "postbackUrl": "https://webhook.site/0d7aef0c-ad93-4a7c-8514-30d9b2896750", "metadata": null, "createdAt": "2025-04-03T15:59:43-03:00", "updatedAt": "2025-04-03T15:59:43-03:00", "paidAt": "2025-04-03T15:59:43.56-03:00", "ip": null, "customer": { "id": "96155cff-4224-46fd-af28-ba58d6b06301", "name": "TESTE PIX", "email": "testepix@gmail.com", "phone": "11999999999", "createdAt": "2025-04-03T15:59:43.131002", "document": "01234567890" }, "card": null, "boleto": null, "pix": { "qrcode": "https://digital.mundipagg.com/pix/", "expirationDate": "2025-04-03T16:19:43-03:00", "end2EndId": "E12345678202009091221abcdef12345", "receiptUrl": null }, "shipping": { "neighborhood": "centro", "zipCode": "49070083", "city": "Aracaju", "complement": "", "streetNumber": "11", "street": "Rua Bolívia", "state": "SE" }, "refusedReason": null, "items": [ { "title": "Camisa G", "unitPrice": 10000, "quantity": 1, "externalRef": "yshZlkj4eFo2imq7TOH158g1mp0akci8" } ], "splits": [ { "recipientId": "21cb8a8b-35e4-44bf-aa72-130a1154b42a", "percentage": 100, "netAmount": 9900 } ], "fee": { "fixedAmount": 1, "spreadPercentage": 0.6, "estimatedFee": 100, "netAmount": 9900 } } } ``` -------------------------------- ### Security Schemes Source: https://korepay.readme.io/reference/put_transactions-id-delivery Details on the security schemes supported by the API, specifically HTTP Basic Authentication. ```APIDOC ## Security Schemes ### HTTP Basic Authentication **Type:** http **Scheme:** basic **Description:** Uses HTTP Basic Authentication where the API Key is provided as the username and the password field is left empty. ``` -------------------------------- ### BoletoConfig Object Source: https://korepay.readme.io/reference/post_transactions Configuration for Boleto payment, specifying the expiration period. ```APIDOC ## BoletoConfig Object ### Description Configuration for Boleto payment, specifying the expiration period. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body - **expiresInDays** (integer) - Required - Dias para vencimento do boleto ### Request Example ```json { "expiresInDays": 3 } ``` ### Response #### Success Response (200) - **expiresInDays** (integer) - Dias para vencimento do boleto. #### Response Example ```json { "expiresInDays": 3 } ``` ``` -------------------------------- ### PixConfig Object Source: https://korepay.readme.io/reference/post_transactions Configuration for Pix payment, specifying the expiration period. ```APIDOC ## PixConfig Object ### Description Configuration for Pix payment, specifying the expiration period. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body - **expiresInDays** (integer) - Required - Dias para expiração do PIX ### Request Example ```json { "expiresInDays": 1 } ``` ### Response #### Success Response (200) - **expiresInDays** (integer) - Dias para expiração do PIX. #### Response Example ```json { "expiresInDays": 1 } ``` ``` -------------------------------- ### Item Object Source: https://korepay.readme.io/reference/post_transactions Represents an item in a transaction, including its title, unit price, and quantity. ```APIDOC ## Item Object ### Description Represents an item in a transaction, including its title, unit price, and quantity. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body - **title** (string) - Required - Nome/descrição do item - **unitPrice** (integer) - Required - Preço unitário em centavos - **quantity** (integer) - Required - Quantidade do item ### Request Example ```json { "title": "Produto Digital Premium", "unitPrice": 2500, "quantity": 1 } ``` ### Response #### Success Response (200) - **title** (string) - Nome/descrição do item. - **unitPrice** (integer) - Preço unitário em centavos. - **quantity** (integer) - Quantidade do item. #### Response Example ```json { "title": "Produto Digital Premium", "unitPrice": 2500, "quantity": 1 } ``` ``` -------------------------------- ### Address Object Source: https://korepay.readme.io/reference/post_transactions Represents an address with detailed fields for street, city, state, country, and more. ```APIDOC ## Address Object ### Description Represents an address with detailed fields for street, city, state, country, and more. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body - **street** (string) - Required - Nome da rua/avenida - **streetNumber** (string) - Required - Número do endereço - **complement** (string) - Optional - Complemento (opcional) - **zipCode** (string) - Required - CEP no formato 12345-678 ou 12345678 - **neighborhood** (string) - Required - Bairro - **city** (string) - Required - Cidade - **state** (string) - Required - Estado (UF) - **country** (string) - Required - País (código ISO) ### Request Example ```json { "street": "Rua das Flores", "streetNumber": "123", "complement": "Apartamento 101", "zipCode": "01234-567", "neighborhood": "Centro", "city": "São Paulo", "state": "SP", "country": "BR" } ``` ### Response #### Success Response (200) - **street** (string) - Nome da rua/avenida - **streetNumber** (string) - Número do endereço - **complement** (string) - Complemento (opcional) - **zipCode** (string) - CEP no formato 12345-678 ou 12345678 - **neighborhood** (string) - Bairro - **city** (string) - Cidade - **state** (string) - Estado (UF) - **country** (string) - País (código ISO) #### Response Example ```json { "street": "Rua das Flores", "streetNumber": "123", "complement": "Apartamento 101", "zipCode": "01234-567", "neighborhood": "Centro", "city": "São Paulo", "state": "SP", "country": "BR" } ``` ``` -------------------------------- ### Card Object Source: https://korepay.readme.io/reference/post_transactions Represents credit card details, allowing either a tokenized card ID or new card information. ```APIDOC ## Card Object ### Description Represents credit card details, allowing either a tokenized card ID or new card information. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body - **id** (string) - Optional - Token do cartão previamente tokenizado. Se informado, outros campos são opcionais. - **number** (string) - Optional - Número do cartão (apenas números). Obrigatório se 'id' não for informado. - **holderName** (string) - Optional - Nome do titular conforme cartão. Obrigatório se 'id' não for informado. - **expirationMonth** (integer) - Optional - Mês de expiração (1-12). Obrigatório se 'id' não for informado. - **expirationYear** (integer) - Optional - Ano de expiração (4 dígitos). Obrigatório se 'id' não for informado. - **cvv** (string) - Optional - Código de segurança (3 ou 4 dígitos). Obrigatório se 'id' não for informado. ### Request Example ```json { "id": "card_token_abc123" } ``` OR ```json { "number": "4111111111111111", "holderName": "JOAO DA SILVA", "expirationMonth": 12, "expirationYear": 2025, "cvv": "123" } ``` ### Response #### Success Response (200) - **id** (string) - Token do cartão previamente tokenizado. #### Response Example ```json { "id": "card_token_abc123" } ``` ``` -------------------------------- ### Authentication Source: https://korepay.readme.io/reference/delete_transactions-id Details on the security schemes supported by the Korepay API. ```APIDOC ## Authentication ### Security Schemes #### Basic Authentication - **Type**: `http` - **Scheme**: `basic` - **Description**: HTTP Basic authentication using API Key as username and leaving password empty. ``` -------------------------------- ### Error Responses Source: https://korepay.readme.io/reference/put_transactions-id-delivery This section details the standard error response formats for various API error conditions, including BadRequest, NotFound, ValidationError, and InternalError. ```APIDOC ## Error Response Formats ### BadRequest **Description:** Returned when the request parameters are malformed. **Content:** ```json { "error": { "code": "BAD_REQUEST", "message": "A requisição contém parâmetros inválidos", "details": [ "O campo 'amount' deve ser um número inteiro" ] } } ``` ### NotFound **Description:** Returned when the requested resource cannot be found. **Content:** ```json { "error": { "code": "NOT_FOUND", "message": "Transação não encontrada" } } ``` ### ValidationError **Description:** Returned when the input data does not meet the required criteria. **Content:** ```json { "error": { "code": "VALIDATION_ERROR", "message": "Dados de entrada inválidos", "details": [ "O e-mail deve ter um formato válido", "O valor mínimo é R$ 1,00" ] } } ``` ### InternalError **Description:** Returned when an unexpected error occurs on the server. **Content:** ```json { "error": { "code": "INTERNAL_ERROR", "message": "Ocorreu um erro interno. Tente novamente em alguns instantes." } } ``` ``` -------------------------------- ### PIX Payment Response Source: https://korepay.readme.io/reference/get_transactions-id Details specific to a PIX payment, including QR code, copy-paste text, expiration date, and end-to-end ID. ```APIDOC ## PIX Payment Details ### Description Provides specific details for a PIX payment, including payment codes and expiration information. ### Method N/A (This describes a response object) ### Endpoint N/A (This describes a response object) ### Parameters None ### Request Example None ### Response #### Success Response (200) - **pix.qrcode** (string) - URL of the PIX QR code. - **pix.qrcodeText** (string) - PIX code for copy and paste. - **pix.expirationDate** (string) - Expiration date of the PIX payment. - **pix.endToEndId** (string) - End-to-end ID of the PIX payment (after payment). #### Response Example ```json { "id": "c856345e-23d6-471d-bb7e-75dfe340c26d", "amount": 5000, "status": "pending", "paymentMethod": "PIX", "createdAt": "2024-08-09T14:30:00Z", "pix": { "qrcode": "https://api.codiguz.com/pix/qr/abc123", "qrcodeText": "00020126580014br.gov.bcb.pix...", "expirationDate": "2024-08-10T14:30:00Z", "endToEndId": "E12345678202408091430123456789" } } ``` ``` -------------------------------- ### Transaction Details Source: https://korepay.readme.io/reference/get_transactions-id Retrieves detailed information about a specific transaction, including its status, amount, payment method, and timestamps. ```APIDOC ## GET /transactions/{id} ### Description Retrieves detailed information about a specific transaction. ### Method GET ### Endpoint /transactions/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the transaction. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **id** (string) - Unique ID of the transaction. - **amount** (integer) - Transaction amount in cents. - **refundedAmount** (integer) - Amount refunded in cents. - **status** (string) - Current status of the transaction (pending, paid, failed, refunded, expired). - **paymentMethod** (string) - Payment method used (PIX, CARD, BOLETO). - **installments** (integer) - Number of installments. - **createdAt** (string) - Date of transaction creation. - **updatedAt** (string) - Date of last update. - **customer** (object) - Customer details. - **items** (array) - List of items in the transaction. #### Response Example ```json { "id": "c856345e-23d6-471d-bb7e-75dfe340c26d", "amount": 5000, "refundedAmount": 0, "status": "paid", "paymentMethod": "PIX", "installments": 1, "createdAt": "2024-08-09T14:30:00Z", "updatedAt": "2024-08-09T14:35:00Z", "customer": { "id": "cust_123", "name": "John Doe", "email": "john.doe@example.com", "document": "12345678900" }, "items": [ { "id": "item_abc", "name": "Product A", "quantity": 1, "amount": 5000 } ] } ``` ``` -------------------------------- ### Boleto Payment Response Source: https://korepay.readme.io/reference/get_transactions-id Details specific to a Boleto payment, typically including a payment link or barcode information. ```APIDOC ## Boleto Payment Details ### Description Provides specific details for a Boleto payment, which may include a payment link or barcode for completion. ### Method N/A (This describes a response object) ### Endpoint N/A (This describes a response object) ### Parameters None ### Request Example None ### Response #### Success Response (200) - **boleto.barcode** (string) - Boleto barcode number. - **boleto.digitableLine** (string) - Boleto digitable line. - **boleto.paymentLink** (string) - URL to pay the Boleto. - **boleto.dueDate** (string) - Due date for the Boleto. #### Response Example ```json { "id": "c856345e-23d6-471d-bb7e-75dfe340c26d", "amount": 5000, "status": "pending", "paymentMethod": "BOLETO", "createdAt": "2024-08-09T14:30:00Z", "boleto": { "barcode": "34191.70700 01001.500527 00000.000000 1 818400005000", "digitableLine": "3419170700010015005200000000001818400005000", "paymentLink": "https://boleto.example.com/pay?id=xyz", "dueDate": "2024-08-15T00:00:00Z" } } ``` ``` -------------------------------- ### Card Payment Response Source: https://korepay.readme.io/reference/get_transactions-id Details specific to a Card payment, including card token ID, brand, holder name, and last digits. ```APIDOC ## Card Payment Details ### Description Provides specific details for a card payment, including card information and branding. ### Method N/A (This describes a response object) ### Endpoint N/A (This describes a response object) ### Parameters None ### Request Example None ### Response #### Success Response (200) - **card.id** (string) - ID of the card token. - **card.brand** (string) - Brand of the card (e.g., Visa, Mastercard). - **card.holderName** (string) - Name of the cardholder. - **card.lastDigits** (string) - Last 4 digits of the card number. - **card.expirationMonth** (integer) - Expiration month of the card. - **card.expirationYear** (integer) - Expiration year of the card. #### Response Example ```json { "id": "c856345e-23d6-471d-bb7e-75dfe340c26d", "amount": 5000, "status": "paid", "paymentMethod": "CARD", "createdAt": "2024-08-09T14:30:00Z", "card": { "id": "card_abc123", "brand": "Visa", "holderName": "JOAO DA SILVA", "lastDigits": "1111", "expirationMonth": 12, "expirationYear": 2025 } } ``` ``` -------------------------------- ### Transaction Refund API Source: https://korepay.readme.io/reference/delete_transactions-id This endpoint allows for the refund of a transaction. Only transactions with the status 'paid' can be refunded. You can perform a full or partial refund. ```APIDOC ## DELETE /transactions/{id} ### Description Realiza o estorno total ou parcial de uma transação paga. Apenas transações com status 'paid' podem ser estornadas. ### Method DELETE ### Endpoint /transactions/{id} #### Path Parameters - **id** (string) - Required - ID único da transação #### Request Body - **amount** (integer) - Optional - Valor a ser estornado em centavos. Se omitido, estorna o valor total. - **reason** (string) - Optional - Motivo do estorno ### Request Example ```json { "amount": 2500, "reason": "Produto não entregue" } ``` ### Response #### Success Response (200) - **id** (string) - ID do estorno - **transactionId** (string) - ID da transação original - **amount** (integer) - Valor estornado em centavos - **status** (string) - Status do estorno (processing, completed, failed) - **createdAt** (string) - Data e hora da criação do estorno #### Response Example ```json { "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "transactionId": "a0eeb994-956b-43f7-a27f-f5b1c8a307f6", "amount": 2500, "status": "completed", "createdAt": "2023-10-27T10:00:00Z" } ``` #### Error Responses - **400 Bad Request**: `#/components/responses/BadRequest` - **404 Not Found**: `#/components/responses/NotFound` - **422 Unprocessable Entity**: `#/components/responses/ValidationError` - **500 Internal Server Error**: `#/components/responses/InternalError` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.