### Get Company Information with cURL Source: https://doc.nitropagamentoshub.com/index This example shows how to retrieve company registration details using cURL. It requires Basic Authentication with your API keys. The response includes company information such as name, contact details, and API keys, but not the account balance. ```bash curl -X GET "https://api.nitropagamento.app/?empresa" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" ``` -------------------------------- ### List Transactions using cURL Source: https://doc.nitropagamentoshub.com/index This example demonstrates how to list all transactions from the Nitro Pagamentos API using cURL. It supports optional query parameters for filtering by page, limit, status, start date, and end date. Authentication is handled via a Basic Authorization header. ```bash curl -X GET "https://api.nitropagamento.app/transactions?page=1&limit=10&status=pago" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" ``` -------------------------------- ### Pix Payment Response Example Source: https://doc.nitropagamentoshub.com/index Example JSON response for a successful Pix payment creation. It includes transaction details such as ID, status, amount, Pix code, and customer information. ```json { "success": true, "data": { "id": "PXB_68E6C0A14DC3D_1759953057", "status": "pendente", "amount": 5, "payment_method": "pix", "pix_code": "00020126860014br.gov.bcb.pix2564pix.bancoe2.com.br/qr/v3/at/afa55845-f3f2-4275-8b31-e4abd...", "pix_qr_code": "iVBORw0KGgoAAAANSUhEUgAAAOwAAADsCAAAAABSuBXIAAAEn0lEQVR42u2dQXLjSAwE+f9Pcy9zmIkVUVltXw...", "external_ref": "12345", "created_at": "2025-10-08 19:50:57", "expires_at": "2025-10-09 19:50:57", "customer": { "name": "João Silva", "email": "joao.silva@email.com", "document": "123.456.789-00", "phone": "11999999999" }, "metadata": { "order_id": "12345", "product_id": "789" } } } ``` -------------------------------- ### PHP Webhook Implementation Example Source: https://doc.nitropagamentoshub.com/index This PHP script demonstrates how to receive and process webhook notifications. It decodes the incoming JSON payload and handles the 'transaction.paid' event. ```php 'received']); } ?> ``` -------------------------------- ### Example Account Summary (JSON) Source: https://doc.nitropagamentoshub.com/index This JSON response provides a summary of withdrawal activities for the account. It includes totals for pending, approved, completed, and canceled withdrawals. ```json { "success": true, "data": { "total_saques": 15, "valor_pendente": 500.00, "valor_aprovado": 750.00, "valor_concluido": 2350.00, "valor_cancelado": 0.00 } } ``` -------------------------------- ### Verify 3DS Active Status (cURL) Source: https://doc.nitropagamentoshub.com/index Example of how to verify if 3D Secure is active for your company using cURL. This request requires an Authorization header. ```bash curl -X GET "https://api.nitropagamento.app/?verificar_3ds" \ -H "Authorization: Basic cGtfbGl2ZV9hYmMxMjM6c2tfbGl2ZV94eXo3ODk=" \ -H "Content-Type: application/json" ``` -------------------------------- ### Example Withdrawal Query (cURL) Source: https://doc.nitropagamentoshub.com/index This cURL command demonstrates how to query the status of a specific withdrawal using its ID. It includes necessary headers for authentication and content type. ```curl curl -X GET "https://api.nitropagamento.app/withdrawal?id=123" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" ``` -------------------------------- ### Example Withdrawal Response (JSON) Source: https://doc.nitropagamentoshub.com/index This JSON object represents a successful response when creating a withdrawal request. It includes details about the transaction status, amounts, and associated data. ```json { "success": true, "message": "Withdrawal request created successfully", "data": { "id": 123, "amount": 20.00, "fee_amount": 0.00, "net_amount": 20.00, "pix_key_type": "cpf", "pix_key": "000.000.000-00", "status": "pendente", "created_at": "2025-01-07 10:30:00", "observacoes": "Saque via api" } } ``` -------------------------------- ### API Error Response Examples Source: https://doc.nitropagamentoshub.com/index This section provides examples of common error responses from the Nitro Pagamentos API. It includes JSON payloads for '401 Unauthorized' errors (due to invalid credentials or missing headers) and '500 Internal Server Error'. ```json { "error": "Invalid API credentials" } ``` ```json { "error": "Internal server error: [mensagem]" } ``` ```json { "error": "Authorization header missing or invalid" } ``` -------------------------------- ### Create Credit Card Payment Request (cURL) Source: https://doc.nitropagamentoshub.com/index Example cURL request to create a credit card payment. This includes payment details, customer information, and sensitive credit card data. Ensure to use HTTPS for secure transmission. ```shell curl -X POST "https://api.nitropagamento.app" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" \ -d '{ "amount": 100.00, "payment_method": "credit_card", "installments": 3, "description": "Compra de produto", "customer": { "name": "João Silva", "email": "joao@example.com", "document": "12345678900", "phone": "11999999999" }, "card": { "number": "4111111111111111", "holder_name": "JOAO SILVA", "expiration_month": "12", "expiration_year": "2026", "cvv": "123" }, "postbackUrl": "https://seusite.com/webhook", "metadata": { "order_id": "12345" } }' ``` -------------------------------- ### Create Credit Card Payment Source: https://doc.nitropagamentoshub.com/index This endpoint allows you to create a new payment transaction using a credit card. It requires details about the amount, installments, customer, and card information. ```APIDOC ## POST /api/payments/credit_card ### Description Creates a new payment transaction using a credit card. ### Method POST ### Endpoint https://api.nitropagamento.app ### Parameters #### Request Body - **amount** (number) - Required - The transaction amount (e.g., 100.00). - **payment_method** (string) - Required - Must be 'credit_card'. - **installments** (integer) - Required - Number of installments (1 to 12). - **description** (string) - Required - Description of the payment. - **customer** (object) - Required - Customer details. - **name** (string) - Required - Customer's full name. - **email** (string) - Required - Customer's email address. - **document** (string) - Required - Customer's document number (CPF or CNPJ, numbers only). - **phone** (string) - Optional - Customer's phone number with DDD (numbers only). - **card** (object) - Required - Credit card details. - **number** (string) - Required - Card number (16 digits). - **holder_name** (string) - Required - Name as it appears on the card. - **expiration_month** (string) - Required - Expiration month (01-12). - **expiration_year** (string) - Required - Expiration year (YYYY). - **cvv** (string) - Required - Security code (3 or 4 digits). - **postbackUrl** (string) - Optional - URL to receive webhook notifications. - **metadata** (object) - Optional - Custom data, such as order ID. - **order_id** (string) - Optional - The order identifier. ### Security **IMPORTANT:** Card data is processed securely and is not stored on our servers. Always use HTTPS for your requests. ### Request Example ```json { "amount": 100.00, "payment_method": "credit_card", "installments": 3, "description": "Compra de produto", "customer": { "name": "João Silva", "email": "joao@example.com", "document": "12345678900", "phone": "11999999999" }, "card": { "number": "4111111111111111", "holder_name": "JOAO SILVA", "expiration_month": "12", "expiration_year": "2026", "cvv": "123" }, "postbackUrl": "https://seusite.com/webhook", "metadata": { "order_id": "12345" } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the payment details. - **id** (string) - The unique identifier for the payment. - **status** (string) - The current status of the transaction (e.g., 'pendente', 'pago'). - **amount** (number) - The transaction amount. - **payment_method** (string) - The payment method used. - **external_ref** (string) - External reference ID. - **created_at** (string) - Timestamp when the payment was created. - **expires_at** (string) - Timestamp when the payment expires. - **customer** (object) - Customer details. - **metadata** (object) - Metadata associated with the payment. #### Response Example ```json { "success": true, "data": { "id": "CC_68E6C0A14DC3D_1759953057", "status": "pendente", "amount": 100.00, "payment_method": "credit_card", "installments": 3, "external_ref": "12345", "created_at": "2025-10-08 19:50:57", "expires_at": "2025-10-09 19:50:57", "customer": { "name": "João Silva", "email": "joao@example.com", "document": "12345678900", "phone": "11999999999" }, "metadata": { "order_id": "12345" } } } ``` ### Transaction Statuses | Status | Description | |-------------|---------------------------------------------------| | pendente | Payment created and awaiting customer confirmation | | pago | Payment confirmed and successfully approved | | reembolsado | Payment has been reversed/refunded to the customer | **Note:** You will receive webhook notifications whenever the transaction status changes. ``` -------------------------------- ### Verify 3DS Active Status (JavaScript) Source: https://doc.nitropagamentoshub.com/index Example of how to verify if 3D Secure is active for your company using JavaScript's Fetch API. It includes setting up credentials and handling the response. ```javascript const chavePublica = 'pk_live_abc123xyz'; const chavePrivada = 'sk_live_xyz789abc'; const credentials = btoa(`${chavePublica}:${chavePrivada}`); fetch('https://api.nitropagamento.app/?verificar_3ds', { method: 'GET', headers: { 'Authorization': `Basic ${credentials}`, 'Content-Type': 'application/json' } }) .then(response => response.json()) .then(data => { if (data.success && data.data['3ds_ativo']) { console.log('3D Secure está ATIVO'); console.log('Adquirente:', data.data.adquirente.nome); } else { console.log('3D Secure está DESATIVADO'); } }) .catch(error => console.error('Erro:', error)); ``` -------------------------------- ### Consult Transaction Status (cURL) Source: https://doc.nitropagamentoshub.com/index Example of how to consult the status of a specific transaction using cURL. This request requires the transaction ID in the URL and an Authorization header. ```bash curl -X GET "https://api.nitropagamento.app/transactions/PXB_68E6C0A14DC3D_1759953057" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" ``` -------------------------------- ### 3DS Inactive Response (No Acquirer) Source: https://doc.nitropagamentoshub.com/index Example of a response when verifying 3D Secure status, indicating that 3DS is inactive because the company does not have an acquirer configured. ```json { "success": true, "data": { "empresa_id": 1, "empresa_nome": "Minha Empresa LTDA", "3ds_ativo": false, "mensagem": "Empresa não possui adquirente de cartão configurado" } } ``` -------------------------------- ### Example Webhook Payload (JSON) Source: https://doc.nitropagamentoshub.com/index This JSON structure represents a webhook notification sent when a transaction's status changes. It includes event details, timestamp, and transaction data. ```json { "event": "transaction.paid", "timestamp": "2025-01-07T08:51:18-03:00", "data": { "transaction_id": "PXB_68E4FE71E4AF4_1759837809", "external_id": "12345", "amount": "25.90", "fee_amount": "1.30", "net_amount": "24.60", "currency": "BRL", "payment_method": "pix", "status": "paid", "created_at": "2025-01-07T08:50:11-03:00", "paid_at": "2025-01-07T08:51:18-03:00", "customer": { "name": "João Silva", "email": "joao.silva@email.com" } } } ``` -------------------------------- ### Create Pix Payment Request (cURL) Source: https://doc.nitropagamentoshub.com/index Example cURL request to create a Pix payment. It includes payment details, customer information, and optional tracking parameters. The API expects a JSON payload with these details. ```shell curl -X POST "https://api.nitropagamento.app" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" \ -d '{ "amount": 25.90, "payment_method": "pix", "description": "Compra de produto XYZ", "items": [ { "title": "Plano Pro", "unitPrice": 2590, "quantity": 1, "tangible": false } ], "customer": { "name": "João Silva", "email": "joao.silva@email.com", "document": "123.456.789-00", "phone": "11999999999" }, "metadata": { "order_id": "12345", "product_id": "789" }, "postbackUrl": "https://seu-site.com/webhook/pagamentos", "tracking": { "src": "google", "utm_source": "google", "utm_medium": "cpc", "utm_campaign": "black_friday_2024", "utm_term": "produto_xyz", "utm_content": "anuncio_1", "sck": "sck_123456", "client_reference_id": "ref_789", "xcode": "xcode_abc" } }' ``` -------------------------------- ### 3DS Active Response Source: https://doc.nitropagamentoshub.com/index Example of a successful response when verifying 3D Secure status, indicating that 3DS is active for the company. ```json { "success": true, "data": { "empresa_id": 1, "empresa_nome": "Minha Empresa LTDA", "3ds_ativo": true, "3ds_status": "ATIVO - Transações terão autenticação 3D Secure", "configuracao_origem": "empresa" } } ``` -------------------------------- ### Consult Transaction Status Response Source: https://doc.nitropagamentoshub.com/index Example of a successful response when consulting a transaction status. It includes transaction details, customer information, and metadata. ```json { "success": true, "data": { "id": "PXB_68E6C0A14DC3D_1759953057", "status": "pago", "amount": 5, "payment_method": "pix", "created_at": "2025-10-08 19:50:57", "paid_at": "2025-10-08 19:51:18", "customer": { "name": "João Silva", "email": "joao.silva@email.com", "document": "123.456.789-00", "phone": "11999999999" }, "metadata": { "order_id": "12345", "product_id": "789" } } } ``` -------------------------------- ### Get Company Information with JavaScript Fetch API Source: https://doc.nitropagamentoshub.com/index This JavaScript snippet demonstrates how to fetch company details from the Nitro Pagamentos API using the Fetch API. It utilizes Base64 encoding for Basic Authentication and logs the company's name, email, and client code to the console. Error handling is included for network issues. ```javascript const chavePublica = 'pk_live_abc123xyz'; const chavePrivada = 'sk_live_xyz789abc'; const credentials = btoa(`${chavePublica}:${chavePrivada}`); fetch('https://api.nitropagamento.app/?empresa', { method: 'GET', headers: { 'Authorization': `Basic ${credentials}`, 'Content-Type': 'application/json' } }) .then(response => response.json()) .then(data => { console.log('Dados da empresa:', data.data); console.log('Nome:', data.data.nome_empresa); console.log('Email:', data.data.email); console.log('Código Cliente:', data.data.codigo_cliente); }) .catch(error => console.error('Erro:', error)); ``` -------------------------------- ### Request PIX Withdrawal using cURL Source: https://doc.nitropagamentoshub.com/index This cURL example shows how to request a PIX withdrawal from the Nitro Pagamentos API. It requires the amount, PIX key type, PIX key, and optionally, observations. The request must be authenticated with a Basic Authorization header and sent via POST method. ```bash curl -X POST "https://api.nitropagamento.app/withdrawal" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" \ -d '{ "amount": 20.00, "pix_key_type": "cpf", "pix_key": "000.000.000-00", "observacoes": "Saque via api" }' ``` -------------------------------- ### Verify 3D Secure Status with PHP Source: https://doc.nitropagamentoshub.com/index This PHP code snippet demonstrates how to check the 3D Secure status for a transaction using the Nitro Pagamentos API. It requires API keys for authentication and makes a GET request to the verification endpoint, returning whether 3D Secure is active and the acquirer's name. ```php $chavePublica = 'pk_live_abc123xyz'; $chavePrivada = 'sk_live_xyz789abc'; $credentials = base64_encode("$chavePublica:$chavePrivada"); $ch = curl_init('https://api.nitropagamento.app/?verificar_3ds'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Basic ' . $credentials, 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true); curl_close($ch); if ($data['success'] && $data['data']['3ds_ativo']) { echo "3D Secure ATIVO\n"; echo "Adquirente: " . $data['data']['adquirente']['nome'] . "\n"; } else { echo "3D Secure DESATIVADO\n"; } ``` -------------------------------- ### Authentication API Source: https://doc.nitropagamentoshub.com/index API uses Basic Authentication with API keys encoded in Base64. Obtain your public (pk_) and private (sk_) keys from the admin panel, combine them as 'pk_:sk_', encode to Base64, and send in the Authorization header. ```APIDOC ## Authentication API ### Description API uses Basic Authentication with API keys encoded in Base64. Obtain your public (pk_) and private (sk_) keys from the admin panel, combine them as 'pk_:sk_', encode to Base64, and send in the Authorization header. ### Method GET, POST, PUT, DELETE (Applies to all endpoints) ### Endpoint `https://api.nitropagamento.app` ### Headers - **Authorization** (string) - Required - Basic Authentication token (`Basic `) - **Content-Type** (string) - Required - `application/json` ### Request Example ```javascript // 1. Combine your keys const credentials = "pk_your_public_key:sk_your_private_key"; // 2. Encode in Base64 const encodedCredentials = btoa(credentials); // 3. Use in Authorization header const headers = { "Authorization": `Basic ${encodedCredentials}`, "Content-Type": "application/json" }; ``` ### Response #### Success Response (200) - **message** (string) - Authentication successful #### Error Response (401) - **message** (string) - Authentication failed ``` -------------------------------- ### Webhooks and PostbackURL Source: https://doc.nitropagamentoshub.com/index Configure webhooks to receive automatic notifications about transaction status changes. ```APIDOC ## Webhooks and PostbackURL ### Description Receive automatic notifications about changes in transaction status by configuring a `postbackUrl`. ### How They Work When a transaction's status changes, a POST request is sent to the URL configured in the `postbackUrl` field. ### Events Sent - **transaction.created**: Triggered immediately after a transaction is created. - **transaction.paid**: Triggered when a transaction is successfully paid. - **transaction.failed**: Triggered when a payment is refused or fails for any reason. - **transaction.expired**: Triggered when the payment deadline is exceeded. - **transaction.refunded**: Triggered when a refund (total or partial) is processed. ### Webhook Structure ```json { "event": "transaction.paid", "timestamp": "2025-01-07T08:51:18-03:00", "data": { "transaction_id": "PXB_68E4FE71E4AF4_1759837809", "external_id": "12345", "amount": "25.90", "fee_amount": "1.30", "net_amount": "24.60", "currency": "BRL", "payment_method": "pix", "status": "paid", "created_at": "2025-01-07T08:50:11-03:00", "paid_at": "2025-01-07T08:51:18-03:00", "customer": { "name": "João Silva", "email": "joao.silva@email.com" } } } ``` ### Webhook Validation #### Security Tips - Always validate the origin of the request. - Use HTTPS for your webhook URL. - Implement retry logic for temporary failures. - Respond with a 200 status code to confirm receipt. ### Implementation Example (PHP) ```php 'received']); } ?> ``` ``` -------------------------------- ### Fetch Company Information using PHP cURL Source: https://doc.nitropagamentoshub.com/index This snippet demonstrates how to fetch company information from the Nitro Pagamentos API using PHP's cURL library. It requires public and private API keys for authentication and outputs company name, email, and customer code upon successful retrieval. ```php $chavePublica = 'pk_live_abc123xyz'; $chavePrivada = 'sk_live_xyz789abc'; $credentials = base64_encode("$chavePublica:$chavePrivada"); $ch = curl_init('https://api.nitropagamento.app/?empresa'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Basic ' . $credentials, 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { $data = json_decode($response, true); echo "Nome: " . $data['data']['nome_empresa'] . "\n"; echo "Email: " . $data['data']['email'] . "\n"; echo "Código: " . $data['data']['codigo_cliente'] . "\n"; } else { echo "Erro: " . $response . "\n"; } ``` -------------------------------- ### Credit Card Payment Refused Response Source: https://doc.nitropagamentoshub.com/index Example of a refused credit card payment response from the Nitro Pagamentos API. It indicates a failed transaction with an error message. ```json { "success": false, "error": "Pagamento recusado", "data": { "id": "CC_695C9F3731CED_1767677752", "status": "recusado", "amount": 10, "payment_method": "credit_card", "card_brand": "mastercard", "card_last_digits": "4962" } } ``` -------------------------------- ### Headers Obrigatórios para Autenticação API NITRO PAGAMENTOS Source: https://doc.nitropagamentoshub.com/index Exemplo dos headers HTTP necessários para autenticar requisições na API NITRO PAGAMENTOS. Inclui o header 'Authorization' com credenciais codificadas em Base64 e 'Content-Type'. ```http Authorization: Basic cGtfc3VhX2NoYXZlX3B1YmxpY2E6c2tfc3VhX2NoYXZlX3ByaXZhZGE= Content-Type: application/json ``` -------------------------------- ### Credit Card Payment Success Response Source: https://doc.nitropagamentoshub.com/index Example of a successful credit card payment response from the Nitro Pagamentos API. It includes transaction details, customer information, and metadata. ```json { "success": true, "data": { "id": "CC_695C9F3731CED_1767677751", "status": "pago", "amount": 10, "payment_method": "credit_card", "card_brand": "mastercard", "card_last_digits": "4962", "installments": 1, "installment_amount": 10, "authorization_code": "TEST480561", "nsu": "NSU203601", "tid": "TID157592201", "created_at": "2026-01-06 13:35:51", "customer": { "name": "João Silva", "email": "joao@example.com", "document": "12345678900", "phone": "11999999999" }, "metadata": { "order_id": "12345" } } } ``` -------------------------------- ### Fetch Company Information using Python Requests Source: https://doc.nitropagamentoshub.com/index This snippet shows how to retrieve company details from the Nitro Pagamentos API using Python's Requests library. It utilizes API keys for basic authentication and prints the company's name, email, and customer code if the request is successful. ```python import requests import base64 chave_publica = 'pk_live_abc123xyz' chave_privada = 'sk_live_xyz789abc' credentials = base64.b64encode(f'{chave_publica}:{chave_privada}'.encode()).decode() response = requests.get( 'https://api.nitropagamento.app/?empresa', headers={ 'Authorization': f'Basic {credentials}', 'Content-Type': 'application/json' } ) if response.status_code == 200: data = response.json() print(f"Nome: {data['data']['nome_empresa']}") print(f"Email: {data['data']['email']}") print(f"Código: {data['data']['codigo_cliente']}") else: print(f"Erro: {response.text}") ``` -------------------------------- ### Consultar Empresa Source: https://doc.nitropagamentoshub.com/index Retrieve detailed information about your authenticated company, including API keys but excluding your current balance. Requires Basic Authentication. ```APIDOC ## GET /?empresa ### Description Retrieves all registered data for the authenticated company, including API keys. Does not include account balance. ### Method GET ### Endpoint `https://api.nitropagamento.app/?empresa` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Headers - **Authorization**: Basic {base64_encoded_credentials} (Required) - **Content-Type**: application/json ### Request Example ```bash curl -X GET "https://api.nitropagamento.app/?empresa" \ -H "Authorization: Basic cGtfdGVzdF8xMjM0NTY6c2tfdGVzdF83ODkwMTI=" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200 OK) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the company's information. - **id** (integer) - Unique company ID. - **codigo_cliente** (string) - Unique client code (e.g., EMP252073). - **nome_empresa** (string) - Company name. - **tipo_pessoa** (string) - Type of person (fisica or juridica). - **cnpj** (string|null) - Company's CNPJ (if tipo_pessoa = juridica). - **cpf** (string|null) - Responsible person's CPF (if tipo_pessoa = fisica). - **email** (string) - Company contact email. - **telefone** (string) - Company contact phone. - **endereco** (string) - Full address. - **cidade** (string) - City. - **estado** (string) - State (UF). - **cep** (string) - Postal code. - **responsavel_nome** (string) - Name of the company's responsible person. - **responsavel_email** (string) - Email of the responsible person. - **responsavel_telefone** (string) - Phone of the responsible person. - **chave_publica** (string) - Public API key (pk_live_...). - **chave_privada** (string) - Private API key (sk_live_...). - **status** (string) - Account status (aprovado, pendente, rejeitado). - **created_at** (datetime) - Account creation date. #### Response Example ```json { "success": true, "data": { "id": 117, "codigo_cliente": "EMP252073", "nome_empresa": "Minha Empresa LTDA", "tipo_pessoa": "juridica", "cnpj": "12.345.678/0001-90", "cpf": null, "email": "contato@minhaempresa.com", "telefone": "11999999999", "endereco": "Rua Exemplo, 123", "cidade": "São Paulo", "estado": "SP", "cep": "01234-567", "responsavel_nome": "João Silva", "responsavel_email": "joao@minhaempresa.com", "responsavel_telefone": "11988888888", "chave_publica": "pk_live_abc123xyz", "chave_privada": "sk_live_xyz789abc", "status": "aprovado", "created_at": "2025-01-01 10:00:00" } } ``` ### Error Handling - **401 Unauthorized**: Missing or invalid Authorization header. - **401 Unauthorized**: Invalid API credentials or inactive company. - **500 Internal Server Error**: An error occurred on the server. ``` -------------------------------- ### POST /create-payment Source: https://doc.nitropagamentoshub.com/index Endpoint to create a new PIX transaction. It accepts payment details, customer information, and optional tracking and item data. ```APIDOC ## POST /create-payment ### Description Endpoint to create a new PIX transaction. It accepts payment details, customer information, and optional tracking and item data. ### Method POST ### Endpoint `https://api.nitropagamento.app/create-payment` ### Parameters #### Request Body - **amount** (number) - Required - Value in BRL (e.g., 5.00) - **payment_method** (string) - Required - Payment method (`pix`) - **description** (string) - Required - Description of the payment - **items** (array) - Optional - List of transaction items. If not provided, an item will be created automatically based on the description and total amount. - **title** (string) - Required - Item/product name - **unitPrice** (integer) - Required - Unit price in cents (e.g., 500 for R$ 5.00) - **quantity** (integer) - Required - Item quantity - **tangible** (boolean) - Required - Whether it's a physical (true) or digital (false) product - **customer** (object) - Optional - Customer data - **name** (string) - Required - Customer name - **email** (string) - Required - Customer email - **document** (string) - Required - Customer document (CPF/CNPJ) - **phone** (string) - Required - Customer phone number - **metadata** (object) - Optional - Custom data (e.g., `order_id`, `product_id`) - **postbackUrl** (string) - Optional - URL to receive webhook notifications - **tracking** (object) - Optional - UTM tracking data for campaign analysis - **src** (string) - Optional - Traffic source (e.g., "google", "facebook") - **utm_source** (string) - Optional - Campaign source (e.g., "google", "newsletter") - **utm_medium** (string) - Optional - Campaign medium (e.g., "cpc", "email", "social") - **utm_campaign** (string) - Optional - Campaign name (e.g., "black_friday", "launch") - **utm_term** (string) - Optional - Campaign term (keywords) - **utm_content** (string) - Optional - Campaign content (ad variation) - **sck** (string) - Optional - SCK for Goodtrack - **client_reference_id** (string) - Optional - Client Reference ID for Goodtrack - **xcode** (string) - Optional - XCode for Goodtrack ### Request Example ```json { "amount": 5.00, "payment_method": "pix", "description": "Pagamento de teste", "items": [ { "title": "Plano Pro", "unitPrice": 2590, "quantity": 1, "tangible": false } ], "customer": { "name": "João Silva", "email": "joao.silva@example.com", "document": "12345678900", "phone": "11987654321" }, "metadata": { "order_id": "order_12345" }, "postbackUrl": "https://yourdomain.com/webhook", "tracking": { "utm_source": "google", "utm_medium": "cpc", "utm_campaign": "summer_sale" } } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the transaction - **status** (string) - Current status of the transaction (e.g., "pending", "completed", "failed") - **pix_code** (string) - The PIX payment code - **qr_code_url** (string) - URL for the PIX QR Code image - **expires_at** (string) - Timestamp when the PIX code expires #### Response Example ```json { "id": "txn_abcdef123456", "status": "pending", "pix_code": "00020126580014br.gov.bcb.pix0136...", "qr_code_url": "https://api.nitropagamento.app/qr/abcdef123456.png", "expires_at": "2023-10-27T10:00:00Z" } ``` #### Error Response (400, 422, 500) - **message** (string) - Error description - **errors** (array) - List of specific validation errors (if applicable) ``` -------------------------------- ### Create PIX Payment Source: https://doc.nitropagamentoshub.com/index This endpoint allows you to create a new payment transaction using the PIX payment method. It includes details about the amount, customer, and optional metadata. ```APIDOC ## POST /api/payments/pix ### Description Creates a new payment transaction using the PIX payment method. ### Method POST ### Endpoint https://api.nitropagamento.app ### Parameters #### Request Body - **amount** (number) - Required - The transaction amount. - **payment_method** (string) - Required - Must be 'pix'. - **description** (string) - Required - Description of the payment. - **items** (array) - Required - List of items included in the payment. - **title** (string) - Required - Name of the item. - **unitPrice** (integer) - Required - Price of the item in cents. - **quantity** (integer) - Required - Quantity of the item. - **tangible** (boolean) - Required - Indicates if the item is tangible. - **customer** (object) - Required - Customer details. - **name** (string) - Required - Customer's full name. - **email** (string) - Required - Customer's email address. - **document** (string) - Required - Customer's document number (CPF or CNPJ). - **phone** (string) - Optional - Customer's phone number. - **metadata** (object) - Optional - Custom data, such as order ID. - **order_id** (string) - Optional - The order identifier. - **product_id** (string) - Optional - The product identifier. - **postbackUrl** (string) - Optional - URL to receive webhook notifications. - **tracking** (object) - Optional - Tracking information for the transaction. ### Request Example ```json { "amount": 25.90, "payment_method": "pix", "description": "Compra de produto XYZ", "items": [ { "title": "Plano Pro", "unitPrice": 2590, "quantity": 1, "tangible": false } ], "customer": { "name": "João Silva", "email": "joao.silva@email.com", "document": "123.456.789-00", "phone": "11999999999" }, "metadata": { "order_id": "12345", "product_id": "789" }, "postbackUrl": "https://seu-site.com/webhook/pagamentos", "tracking": { "src": "google", "utm_source": "google", "utm_medium": "cpc", "utm_campaign": "black_friday_2024", "utm_term": "produto_xyz", "utm_content": "anuncio_1", "sck": "sck_123456", "client_reference_id": "ref_789", "xcode": "xcode_abc" } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the payment details. - **id** (string) - The unique identifier for the payment. - **status** (string) - The current status of the transaction (e.g., 'pendente', 'pago'). - **amount** (number) - The transaction amount. - **payment_method** (string) - The payment method used. - **pix_code** (string) - The PIX payment code (if applicable). - **pix_qr_code** (string) - The PIX QR code image data (if applicable). - **external_ref** (string) - External reference ID. - **created_at** (string) - Timestamp when the payment was created. - **expires_at** (string) - Timestamp when the payment expires. - **customer** (object) - Customer details. - **metadata** (object) - Metadata associated with the payment. #### Response Example ```json { "success": true, "data": { "id": "PXB_68E6C0A14DC3D_1759953057", "status": "pendente", "amount": 5, "payment_method": "pix", "pix_code": "00020126860014br.gov.bcb.pix2564pix.bancoe2.com.br/qr/v3/at/afa55845-f3f2-4275-8b31-e4abd...", "pix_qr_code": "iVBORw0KGgoAAAANSUhEUgAAAOwAAADsCAAAAABSuBXIAAAEn0lEQVR42u2dQXLjSAwE+f9Pcy9zmIkVUVltXw...", "external_ref": "12345", "created_at": "2025-10-08 19:50:57", "expires_at": "2025-10-09 19:50:57", "customer": { "name": "João Silva", "email": "joao.silva@email.com", "document": "123.456.789-00", "phone": "11999999999" }, "metadata": { "order_id": "12345", "product_id": "789" } } } ``` ### Transaction Statuses | Status | Description | |-------------|---------------------------------------------------| | pendente | Payment created and awaiting customer confirmation | | pago | Payment confirmed and successfully approved | | reembolsado | Payment has been reversed/refunded to the customer | **Note:** You will receive webhook notifications whenever the transaction status changes. ``` -------------------------------- ### Autenticação API NITRO PAGAMENTOS (JavaScript) Source: https://doc.nitropagamentoshub.com/index Exemplo de como gerar as credenciais de autenticação para a API NITRO PAGAMENTOS usando JavaScript. Combina chaves pública e privada, codifica em Base64 e formata para o header 'Authorization'. ```javascript const credentials = "pk_sua_chave_publica:sk_sua_chave_privada"; const encodedCredentials = btoa(credentials); const headers = { "Authorization": `Basic ${encodedCredentials}`, "Content-Type": "application/json" }; ```