### List Anticipations (Shell) Source: https://app.hurapay.com.br/docs/antecipation/list-antecipations The GET /antecipation route allows listing all anticipations. It supports pagination through 'page' and 'pageSize' query parameters. 'page' defaults to 1, and 'pageSize' defaults to 20 with a maximum of 50. ```Shell curl --request GET \ --url https://api.hurapay.com.br/v1/antecipation \ --header 'accept: application/json' \ --header 'authorization: Basic Og==' ``` -------------------------------- ### Boleto Transaction Example Source: https://app.hurapay.com.br/docs/intro/postbacks-format This section provides an example of a transaction using the 'boleto' payment method. It details the structure of the JSON payload for such a transaction, including fields for transaction data, customer information, payment details, and boleto-specific information like the barcode and digitable line. ```APIDOC ## Boleto Transaction Example ### Description This endpoint demonstrates a transaction using the 'boleto' payment method. The JSON payload includes comprehensive details about the transaction, customer, and the generated boleto information. ### Method POST ### Endpoint `/websites/app_hurapay_br/transactions` ### Request Body * **type** (string) - Type of the entity, expected to be "transaction". * **url** (string) - The webhook URL for receiving transaction updates. * **objectId** (string) - Unique identifier for the transaction object. * **data** (object) - Contains the detailed transaction information: * **id** (integer) - Transaction ID. * **tenantId** (string) - Tenant identifier. * **companyId** (integer) - Company identifier. * **amount** (integer) - Transaction amount. * **currency** (string) - Currency of the transaction (e.g., "BRL"). * **paymentMethod** (string) - Payment method used (e.g., "boleto"). * **status** (string) - Current status of the transaction (e.g., "waiting_payment"). * **installments** (integer) - Number of installments. * **paidAt** (string/null) - Timestamp when the payment was made. * **paidAmount** (integer) - Amount that has been paid. * **refundedAt** (string/null) - Timestamp when the refund was processed. * **refundedAmount** (integer) - Amount that has been refunded. * **postbackUrl** (string) - URL for postback notifications. * **returnUrl** (string) - URL to redirect the user after the transaction. * **redirectUrl** (string) - URL for redirecting the user to payment. * **metadata** (string) - Additional metadata, often as a JSON string. * **ip** (string) - IP address of the user. * **externalRef** (string) - External reference ID. * **secureId** (string) - Secure ID for the transaction. * **secureUrl** (string) - Secure URL for payment. * **createdAt** (string) - Timestamp when the transaction was created. * **updatedAt** (string) - Timestamp when the transaction was last updated. * **payer** (object/null) - Information about the payer. * **traceable** (boolean) - Indicates if the transaction is traceable. * **authorizationCode** (string/null) - Authorization code for the transaction. * **basePrice** (number/null) - Base price of the transaction. * **interestRate** (number/null) - Interest rate applied. * **items** (array) - List of items in the transaction. * **title** (string) - Item title. * **quantity** (integer) - Quantity of the item. * **tangible** (boolean) - Whether the item is tangible. * **unitPrice** (integer) - Unit price of the item. * **externalRef** (string) - External reference for the item. * **customer** (object) - Information about the customer: * **id** (integer) - Customer ID. * **name** (string) - Customer name. * **email** (string) - Customer email. * **phone** (string) - Customer phone number. * **birthdate** (string) - Customer birthdate. * **createdAt** (string) - Timestamp when the customer was created. * **externalRef** (string/null) - External reference for the customer. * **document** (object) - Customer's document information: * **type** (string) - Document type (e.g., "cpf"). * **number** (string) - Document number. * **address** (object) - Customer's address details. * **street** (string) - Street name. * **streetNumber** (string) - Street number. * **complement** (string) - Address complement. * **zipCode** (string) - Zip code. * **neighborhood** (string) - Neighborhood. * **city** (string) - City. * **state** (string) - State. * **country** (string) - Country. * **fee** (object) - Fee details for the transaction. * **netAmount** (integer) - Net amount after fees. * **estimatedFee** (integer) - Estimated fee amount. * **fixedAmount** (integer) - Fixed fee amount. * **spreadPercent** (integer) - Spread percentage. * **currency** (string) - Fee currency. * **splits** (array) - Details of fund splits. * **amount** (integer) - Amount for the split. * **netAmount** (integer) - Net amount for the split. * **recipientId** (integer) - ID of the recipient. * **chargeProcessingFee** (boolean) - Whether to charge processing fee. * **refunds** (array) - List of refunds. * **pix** (object/null) - Pix transaction details. * **boleto** (object) - Boleto specific details: * **url** (string) - URL to the boleto PDF. * **barcode** (string) - URL to the boleto barcode image. * **digitableLine** (string) - The digitable line of the boleto. * **instructions** (string) - Payment instructions. * **expirationDate** (string) - Boleto expiration date. * **card** (object/null) - Card transaction details. * **refusedReason** (string/null) - Reason for transaction refusal. * **shipping** (object) - Shipping details. * **fee** (integer) - Shipping fee. * **address** (object) - Shipping address. * **delivery** (object) - Delivery status details. * **threeDS** (object) - 3D Secure details. ### Request Example ```json { "type": "transaction", "url": "https://webhook.exemplo.com/retorno", "objectId": "123457", "data": { "id": 123457, "tenantId": "abcd1111-2222-3333-4444-555566667777", "companyId": 99, "amount": 890, "currency": "BRL", "paymentMethod": "boleto", "status": "waiting_payment", "installments": 1, "paidAt": null, "paidAmount": 0, "refundedAt": null, "refundedAmount": 0, "postbackUrl": "https://webhook.exemplo.com/retorno", "returnUrl": "https://minhaapi.com/return", "redirectUrl": "https://minhaapi.com/redirect", "metadata": "{ orderId: 123 }", "ip": "198.51.100.10", "externalRef": "pedido-xyz-002", "secureId": "fake-secure-id-0002", "secureUrl": "https://pagamento.exemplo.com/pagar/fake-secure-id-0002", "createdAt": "2025-04-29T16:00:00.000Z", "updatedAt": "2025-04-29T16:00:00.000Z", "payer": null, "traceable": false, "authorizationCode": null, "basePrice": null, "interestRate": null, "items": [ { "title": "Assinatura Premium", "quantity": 1, "tangible": false, "unitPrice": 890, "externalRef": "item-premium-001" } ], "customer": { "id": 101, "name": "Ana Teste da Silva", "email": "ana.silva@exemplo.com", "phone": "11991234567", "birthdate": "1988-04-10", "createdAt": "2025-01-10T10:30:00.000Z", "externalRef": null, "document": { "type": "cpf", "number": "00011122233" }, "address": { "street": "Av. Fictícia", "streetNumber": "500", "complement": "Apto 101", "zipCode": "01234567", "neighborhood": "Bairro Legal", "city": "São Paulo", "state": "SP", "country": "BR" } }, "fee": { "netAmount": 880, "estimatedFee": 10, "fixedAmount": 10, "spreadPercent": 1, "currency": "BRL" }, "splits": [ { "amount": 890, "netAmount": 880, "recipientId": 888, "chargeProcessingFee": false } ], "refunds": [], "pix": null, "boleto": { "url": "https://pagamentos.exemplo.com/boletos/123457.pdf", "barcode": "https://pagamentos.exemplo.com/boletos/123457/barcode", "digitableLine": "23790123000000008901234560000000012345670000", "instructions": "Pagar até o vencimento. Após, sujeito a juros.", "expirationDate": "2025-05-02" }, "card": null, "refusedReason": null, "shipping": { "fee": 0, "address": { "street": "Av. Fictícia", "streetNumber": "500", "complement": "Apto 101", "neighborhood": "Bairro Legal", "zipCode": "01234567", "city": "São Paulo", "state": "SP", "country": "BR" } }, "delivery": { "status": "waiting", "trackingCode": null, "createdAt": "2025-04-29T16:00:00.000Z", "updatedAt": "2025-04-29T16:00:00.000Z" }, "threeDS": { "redirectUrl": "https://minhaapi.com/redirect", "returnUrl": "https://minhaapi.com/return", "token": "jkhasdJHKHJKUASJKHhjksadhjkjkhHJjsfhd43ASasdfuih23jkKHBASVLdasfkjlh43" } } } ``` ### Response #### Success Response (200) * **type** (string) - Type of the entity, e.g., "transaction". * **data** (object) - Contains the detailed transaction information, mirroring the request data with potential updates like payment confirmation. #### Response Example ```json { "type": "transaction", "data": { "id": 123457, "tenantId": "abcd1111-2222-3333-4444-555566667777", "companyId": 99, "amount": 890, "currency": "BRL", "paymentMethod": "boleto", "status": "waiting_payment", "installments": 1, "paidAt": null, "paidAmount": 0, "refundedAt": null, "refundedAmount": 0, "postbackUrl": "https://webhook.exemplo.com/retorno", "returnUrl": "https://minhaapi.com/return", "redirectUrl": "https://minhaapi.com/redirect", "metadata": "{ orderId: 123 }", "ip": "198.51.100.10", "externalRef": "pedido-xyz-002", "secureId": "fake-secure-id-0002", "secureUrl": "https://pagamento.exemplo.com/pagar/fake-secure-id-0002", "createdAt": "2025-04-29T16:00:00.000Z", "updatedAt": "2025-04-29T16:00:00.000Z", "payer": null, "traceable": false, "authorizationCode": null, "basePrice": null, "interestRate": null, "items": [ { "title": "Assinatura Premium", "quantity": 1, "tangible": false, "unitPrice": 890, "externalRef": "item-premium-001" } ], "customer": { "id": 101, "name": "Ana Teste da Silva", "email": "ana.silva@exemplo.com", "phone": "11991234567", "birthdate": "1988-04-10", "createdAt": "2025-01-10T10:30:00.000Z", "externalRef": null, "document": { "type": "cpf", "number": "00011122233" }, "address": { "street": "Av. Fictícia", "streetNumber": "500", "complement": "Apto 101", "zipCode": "01234567", "neighborhood": "Bairro Legal", "city": "São Paulo", "state": "SP", "country": "BR" } }, "fee": { "netAmount": 880, "estimatedFee": 10, "fixedAmount": 10, "spreadPercent": 1, "currency": "BRL" }, "splits": [ { "amount": 890, "netAmount": 880, "recipientId": 888, "chargeProcessingFee": false } ], "refunds": [], "pix": null, "boleto": { "url": "https://pagamentos.exemplo.com/boletos/123457.pdf", "barcode": "https://pagamentos.exemplo.com/boletos/123457/barcode", "digitableLine": "23790123000000008901234560000000012345670000", "instructions": "Pagar até o vencimento. Após, sujeito a juros.", "expirationDate": "2025-05-02" }, "card": null, "refusedReason": null, "shipping": { "fee": 0, "address": { "street": "Av. Fictícia", "streetNumber": "500", "complement": "Apto 101", "neighborhood": "Bairro Legal", "zipCode": "01234567", "city": "São Paulo", "state": "SP", "country": "BR" } }, "delivery": { "status": "waiting", "trackingCode": null, "createdAt": "2025-04-29T16:00:00.000Z", "updatedAt": "2025-04-29T16:00:00.000Z" }, "threeDS": { "redirectUrl": "https://minhaapi.com/redirect", "returnUrl": "https://minhaapi.com/return", "token": "jkhasdJHKHJKUASJKHhjksadhjkjkhHJjsfhd43ASasdfuih23jkKHBASVLdasfkjlh43" } } } ``` ``` -------------------------------- ### HURAPAY Transaction Example (JSON) Source: https://app.hurapay.com.br/docs/intro/postbacks-format An example of a transaction object for a credit card payment within the HURAPAY platform. This illustrates the structure and fields available for tracking payment details, customer information, and associated items. ```json { "id": 123456, "type": "transaction", "objectId": "999", "url": "https://minhaapi.com/retorno", "data": { "id": 999, "amount": 15000, "refundedAmount": 0, "companyId": 99, "installments": 3, "paymentMethod": "credit_card", "status": "paid", "postbackUrl": "https://minhaapi.com/webhook", "metadata": "{ orderId: 123 }", "traceable": true, "secureId": "abc12345-def6-7890-ghij-klmnopqrstuv", "secureUrl": "https://pagamento.ficticio.com.br/pagar/abc12345-def6-7890-ghij-klmnopqrstuv", "createdAt": "2025-04-20T10:00:00.000Z", "updatedAt": "2025-04-20T10:01:00.000Z", "paidAt": "2025-04-20T10:02:00.000Z", "ip": "192.0.2.1", "externalRef": "trans-xyz-001", "customer": { "id": 50, "externalRef": "cliente-xyz", "name": "João da Silva", "email": "joao@emailficticio.com", "phone": "11912345678", "birthdate": "1990-05-10", "createdAt": "2025-01-01T12:00:00.000Z", "document": { "number": "98765432100", "type": "cpf" }, "address": { "street": "Av. Exemplo", "streetNumber": "123", "complement": "Bloco B", "zipCode": "01001000", "neighborhood": "Centro", "city": "São Paulo", "state": "SP", "country": "BR" } }, "card": { "id": 88, "brand": "mastercard", "holderName": "JOÃO DA SILVA", "lastDigits": "4321", "expirationMonth": 12, "expirationYear": 2030, "reusable": false, "createdAt": "2025-04-19T15:00:00.000Z" }, "boleto": null, "pix": null, "shipping": null, "refusedReason": null, "items": [ { "externalRef": "item-abc-01", "title": "Camisa Personalizada", "unitPrice": 15000, "quantity": 1, "tangible": true } ], "splits": [ { "recipientId": 10, "amount": 15000, "netAmount": 14100 } ], "refunds": [], "delivery": null, "fee": { "fixedAmount": 300, "spreadPercentage": 4, "estimatedFee": 600, "netAmount": 14100 }, "threeDS": { "redirectUrl": "https://minhaapi.com/redirect", "returnUrl": "https://minhaapi.com/return", "token": "jkhasdJHKHJKUASJKHhjksadhjkjkhHJjsfhd43ASasdfuih23jkKHBASVLdasfkjlh43" } } } ``` -------------------------------- ### Prepare 3DS Authentication Parameters (Node.js) Source: https://app.hurapay.com.br/docs/sales/using-3ds This function prepares the necessary parameters for 3DS authentication. It should be called before the encrypt function and whenever amount, installments, or currency values change. It requires converting decimal monetary values to cents using `convertDecimalToCents`. ```javascript const currency = "BRL"; const amount = window["ShieldHelper"].convertDecimalToCents(3.50, currency); // Valor em centavos: 350 await window["ShieldHelper"].prepareThreeDS({ amount: 350, // Valor da transação em centavos da moeda "currency" installments: 1, // Número de parcelas }); ``` -------------------------------- ### Node.js API Authentication and Transaction Example Source: https://app.hurapay.com.br/docs/intro/first-steps This snippet demonstrates how to authenticate with the HURAPAY API using Basic Access Authentication in Node.js and make a POST request to create a transaction. It includes setting up the authorization header with base64 encoded credentials and sending a JSON payload. ```javascript try { const url = 'https://api.hurapay.com.br/v1/transactions'; const publicKey = 'PUBLIC_KEY'; const secretKey = 'SECRET_KEY'; const auth = 'Basic ' + Buffer.from(publicKey + ':' + secretKey).toString('base64'); const payload = { amount: 100, paymentMethod: 'pix', // Valores do payload aqui... }; const response = await fetch(url, { method: 'POST', headers: { Authorization: auth, 'Content-Type': 'application/json', }, body: JSON.stringify(payload), }); const data = await response.json(); console.log(data); } catch (error) { console.error('Erro na requisição:', error); } ``` -------------------------------- ### Get Balance Source: https://app.hurapay.com.br/docs/antecipation/list-antecipations Retrieves the current balance. ```APIDOC ## GET /saldo ### Description Retrieves the current balance. ### Method GET ### Endpoint https://api.hurapay.com.br/v1/saldo ### Response #### Success Response (200) - **balance** (object) - An object containing the current balance information. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Listar Saques - HURAPAY API Source: https://app.hurapay.com.br/docs/withdraw/list-withdraw A rota GET /transfers permite listar todos os saques associados a uma chave de saque. Aceita parâmetros de query para paginação como 'page' e 'pageSize'. ```shell curl --request GET \ --url https://api.hurapay.com.br/v1/transfers/ \ --header 'accept: application/json' \ --header 'authorization: Basic Og==' ``` -------------------------------- ### Boleto Transaction Example (JSON) Source: https://app.hurapay.com.br/docs/intro/postbacks-format This JSON object represents a transaction using the 'boleto' payment method. It includes details about the transaction, payer, items, and specific boleto information like URL, barcode, and digitable line. The 'url' field points to the webhook for receiving transaction updates. ```json { "type": "transaction", "url": "https://webhook.exemplo.com/retorno", "objectId": "123457", "data": { "id": 123457, "tenantId": "abcd1111-2222-3333-4444-555566667777", "companyId": 99, "amount": 890, "currency": "BRL", "paymentMethod": "boleto", "status": "waiting_payment", "installments": 1, "paidAt": null, "paidAmount": 0, "refundedAt": null, "refundedAmount": 0, "postbackUrl": "https://webhook.exemplo.com/retorno", "returnUrl": "https://minhaapi.com/return", "redirectUrl": "https://minhaapi.com/redirect", "metadata": "{ orderId: 123 }", "ip": "198.51.100.10", "externalRef": "pedido-xyz-002", "secureId": "fake-secure-id-0002", "secureUrl": "https://pagamento.exemplo.com/pagar/fake-secure-id-0002", "createdAt": "2025-04-29T16:00:00.000Z", "updatedAt": "2025-04-29T16:00:00.000Z", "payer": null, "traceable": false, "authorizationCode": null, "basePrice": null, "interestRate": null, "items": [ { "title": "Assinatura Premium", "quantity": 1, "tangible": false, "unitPrice": 890, "externalRef": "item-premium-001" } ], "customer": { "id": 101, "name": "Ana Teste da Silva", "email": "ana.silva@exemplo.com", "phone": "11991234567", "birthdate": "1988-04-10", "createdAt": "2025-01-10T10:30:00.000Z", "externalRef": null, "document": { "type": "cpf", "number": "00011122233" }, "address": { "street": "Av. Fictícia", "streetNumber": "500", "complement": "Apto 101", "zipCode": "01234567", "neighborhood": "Bairro Legal", "city": "São Paulo", "state": "SP", "country": "BR" } }, "fee": { "netAmount": 880, "estimatedFee": 10, "fixedAmount": 10, "spreadPercent": 1, "currency": "BRL" }, "splits": [ { "amount": 890, "netAmount": 880, "recipientId": 888, "chargeProcessingFee": false } ], "refunds": [], "pix": null, "boleto": { "url": "https://pagamentos.exemplo.com/boletos/123457.pdf", "barcode": "https://pagamentos.exemplo.com/boletos/123457/barcode", "digitableLine": "23790123000000008901234560000000012345670000", "instructions": "Pagar até o vencimento. Após, sujeito a juros.", "expirationDate": "2025-05-02" }, "card": null, "refusedReason": null, "shipping": { "fee": 0, "address": { "street": "Av. Fictícia", "streetNumber": "500", "complement": "Apto 101", "neighborhood": "Bairro Legal", "zipCode": "01234567", "city": "São Paulo", "state": "SP", "country": "BR" } }, "delivery": { "status": "waiting", "trackingCode": null, "createdAt": "2025-04-29T16:00:00.000Z", "updatedAt": "2025-04-29T16:00:00.000Z" }, "threeDS": { "redirectUrl": "https://minhaapi.com/redirect", "returnUrl": "https://minhaapi.com/return", "token": "jkhasdJHKHJKUASJKHhjksadhjkjkhHJjsfhd43ASasdfuih23jkKHBASVLdasfkjlh43" } } } ``` -------------------------------- ### Pix Transaction JSON Example Source: https://app.hurapay.com.br/docs/intro/postbacks-format This JSON object represents a sample transaction initiated using the Pix payment method. It includes essential fields for transaction details, customer information, payment method specifics, and metadata. This structure is used to process and record Pix payments. ```json { "type": "transaction", "url": "https://webhook.exemplo.com", "objectId": "123456", "data": { "id": 123456, "tenantId": "abcd1234-5678-90ab-cdef-1234567890ab", "companyId": 99, "amount": 750, "currency": "BRL", "paymentMethod": "pix", "status": "waiting_payment", "installments": 1, "paidAt": null, "paidAmount": 0, "refundedAt": null, "refundedAmount": 0, "postbackUrl": "https://webhook.exemplo.com", "metadata": "{ orderId: 123 }", "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "externalRef": "pedido-abc123", "secureId": "fake-secure-id-0001", "secureUrl": "https://pagamento.exemplo.com/pagar/fake-secure-id-0001", "createdAt": "2025-04-29T10:00:00.000Z", "updatedAt": "2025-04-29T10:00:00.000Z", "payer": null, "traceable": false, "authorizationCode": null, "basePrice": 750, "interestRate": 0, "items": [ { "title": "Produto Teste Fictício", "quantity": 1, "tangible": true, "unitPrice": 750, "externalRef": "item-test-001" } ], "customer": { "id": 789, "name": "Carlos Exemplar", "email": "carlos.exemplar@exemplo.com", "phone": "11987654321", "birthdate": "1995-08-20", "createdAt": "2025-01-01T12:00:00.000Z", "externalRef": null, "document": { "type": "cpf", "number": "00011122233" }, "address": { "street": "Rua Fictícia", "streetNumber": "100", "complement": "Apto 10", "zipCode": "12345678", "neighborhood": "Bairro Teste", "city": "Cidade Exemplo", "state": "EX", "country": "BR" } }, "fee": { "netAmount": 738, "estimatedFee": 12, "fixedAmount": 12, "spreadPercent": 1, "currency": "BRL" }, "splits": [ { "amount": 750, "netAmount": 738, "recipientId": 999, "chargeProcessingFee": false } ], "refunds": [], "pix": { "qrcode": "00020101021226870014br.gov.bcb.pix2569pix.pagamento.exemplo.com/pix/v2/abc1234504000053039865802BR5909Carlos EX6008EXEMPLO62070503***6304FAKE", "end2EndId": null, "receiptUrl": null, "expirationDate": "2025-04-30" }, "boleto": null, "card": null, "refusedReason": null, "shipping": null, "delivery": null, "threeDS": { "redirectUrl": "https://minhaapi.com/redirect", "returnUrl": "https://minhaapi.com/return", "token": "jkhasdJHKHJKUASJKHhjksadhjkjkhHJjsfhd43ASasdfuih23jkKHBASVLdasfkjlh43" } } } ``` -------------------------------- ### Create Sale using cURL Source: https://app.hurapay.com.br/docs/sales/create-sale This snippet demonstrates how to create a sale transaction using the cURL command-line tool. It specifies the request method, URL, headers (accept, authorization, content-type), and the JSON body containing transaction details. ```Shell curl --request POST \ --url https://api.hurapay.com.br/v1/transactions \ --header 'accept: application/json' \ --header 'authorization: Basic Og==' \ --header 'content-type: application/json' ``` -------------------------------- ### List Sales using GET /transactions Source: https://app.hurapay.com.br/docs/sales/list-sales The GET /transactions route allows you to list all your sales. It supports pagination through 'page' and 'pageSize' query parameters. 'page' defaults to 1, and 'pageSize' defaults to 20 with a maximum of 50. ```Shell curl --request GET \ --url https://api.hurapay.com.br/v1/transactions \ --header 'accept: application/json' \ --header 'authorization: Basic Og==' ``` ```Node.js const axios = require('axios'); const getSales = async (page = 1, pageSize = 20) => { try { const response = await axios.get('https://api.hurapay.com.br/v1/transactions', { headers: { 'accept': 'application/json', 'authorization': 'Basic Og==' }, params: { page: page, pageSize: pageSize } }); return response.data; } catch (error) { console.error('Error fetching sales:', error); throw error; } }; // Example usage: // getSales(1, 20).then(data => console.log(data)).catch(err => console.error(err)); ``` ```Ruby require 'net/http' require 'uri' uri = URI.parse('https://api.hurapay.com.br/v1/transactions') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) request['accept'] = 'application/json' request['authorization'] = 'Basic Og==' response = http.request(request) puts response.body ``` ```Python import requests url = "https://api.hurapay.com.br/v1/transactions" headers = { 'accept': 'application/json', 'authorization': 'Basic Og==' } params = { 'page': 1, 'pageSize': 20 } try: response = requests.get(url, headers=headers, params=params) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error fetching sales: {e}") ``` ```PHP ``` -------------------------------- ### Create Sale using Ruby Source: https://app.hurapay.com.br/docs/sales/create-sale This snippet demonstrates how to create a sale transaction using Ruby. It uses the 'httparty' gem to send a POST request to the HURApay API, including required headers and a JSON body representing the transaction details. ```ruby require 'httparty' url = 'https://api.hurapay.com.br/v1/transactions' options = { headers: { 'accept': 'application/json', 'authorization': 'Basic Og==', 'content-type': 'application/json' }, body: { # Add your transaction payload here # For example: # amount: 1000, # paymentMethod: 'credit_card', # ... }.to_json } response = HTTParty.post(url, options) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` -------------------------------- ### GET /v1/transfers/{id} - Buscar Saque Source: https://app.hurapay.com.br/docs/withdraw/find-withdraw Retrieves the details of a withdrawal by its ID. ```APIDOC ## GET /v1/transfers/{id} ### Description This endpoint retrieves the details of a withdrawal using its unique ID. ### Method GET ### Endpoint `https://api.hurapay.com.br/v1/transfers/{id}` ### Parameters #### Header Parameters - **x-withdraw-keystring** (string) - Required - External withdrawal key linked to the user. #### Path Parameters - **id** (integer) - Required - ID of the transfer. ### Request Example ```shell curl --request GET \ --url https://api.hurapay.com.br/v1/transfers/%7Bid%7D \ --header 'accept: application/json' \ --header 'authorization: Basic Og==' ``` ### Response #### Success Response (200) - **(object)** - Withdrawal details in case of successful query. #### Error Response (400) - **(object)** - Response object in case of failure. #### Response Example (200) { "example": "{\"id\": \"123e4567-e89b-12d3-a456-426614174000\", \"amount\": 100.50, \"status\": \"completed\", \"createdAt\": \"2023-10-27T10:00:00Z\"}" } #### Response Example (400) { "example": "{\"error\": \"Invalid ID provided\"}" } ``` -------------------------------- ### Create Sale using Python Source: https://app.hurapay.com.br/docs/sales/create-sale This snippet illustrates how to create a sale transaction using Python. It employs the 'requests' library to perform a POST request to the HURApay API, specifying the necessary headers and a JSON payload for the transaction. ```python import requests import json url = 'https://api.hurapay.com.br/v1/transactions' headers = { 'accept': 'application/json', 'authorization': 'Basic Og==', 'content-type': 'application/json' } transaction_data = { # Add your transaction payload here # For example: # "amount": 1000, # "paymentMethod": "credit_card", # ... } try: response = requests.post(url, headers=headers, data=json.dumps(transaction_data)) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error creating sale: {e}") ``` -------------------------------- ### List Sales Source: https://app.hurapay.com.br/docs/sales/list-sales The GET /transactions route allows you to list all your sales. It supports pagination through `page` and `pageSize` query parameters. ```APIDOC ## GET /v1/transactions ### Description Retrieves a paginated list of all sales transactions. ### Method GET ### Endpoint https://api.hurapay.com.br/v1/transactions ### Query Parameters - **page** (integer) - Optional - The page number of the results to be returned. Defaults to 1. - **pageSize** (integer) - Optional - The number of items to be displayed per page. Defaults to 20, with a maximum of 50. ### Request Example ``` curl --request GET \ --url https://api.hurapay.com.br/v1/transactions \ --header 'accept: application/json' \ --header 'authorization: Basic Og==' ``` ### Response #### Success Response (200) - **transactions** (array) - A list of sales objects, each containing transaction details. - **pagination** (object) - Pagination information including current page, total pages, etc. #### Response Example ```json { "transactions": [ { "id": "txn_123", "amount": 10000, "status": "approved", "createdAt": "2023-10-27T10:00:00Z" } ], "pagination": { "currentPage": 1, "totalPages": 5, "pageSize": 20 } } ``` #### Error Response (400) - **error** (string) - A message describing the error. ```json { "error": "Invalid page size parameter." } ``` ``` -------------------------------- ### Create Anticipation Source: https://app.hurapay.com.br/docs/sales/create-sale Creates a request to anticipate funds from future receivables. ```APIDOC ## POST /v1/anticipations ### Description Creates a request to anticipate funds from future receivables. ### Method POST ### Endpoint https://api.hurapay.com.br/v1/anticipations ### Parameters #### Request Body - **amount** (integer) - Required - The amount to anticipate in cents. - **installments** (integer) - Required - The number of installments to anticipate. ### Request Example ```json { "amount": 10000, "installments": 5 } ``` ### Response #### Success Response (200) - **anticipationId** (string) - Unique identifier for the anticipation. - **status** (string) - The status of the anticipation request. #### Response Example ```json { "anticipationId": "ant_jkl012", "status": "pending" } ``` ```