### Node.js RSA Signature Authentication Example Source: https://dom-pagamentos.readme.io/reference/autentica%C3%A7%C3%A3o-com-assinatura-rsa This example shows how to sign a payload using a private key, set up authentication headers with a token and signature, and send a POST request to the API for signature verification. Ensure you have the 'axios' library installed and replace placeholders with your actual token and key path. ```javascript const url = 'https://apiv3.dompagamentos.com.br/checkout/production/verify-signature-rsa'; // Token de autenticação const token = '{{seu_token}}'; (async () => { try { // Assina o payload com a chave privada const signature = signPayload(payload, privateKeyPath); // Configuração do cabeçalho const headers = { 'Content-Type': 'application/json', 'Signature': signature, 'Authorization': `Bearer ${token}` }; // Envia a requisição POST usando axios const response = await axios.post(url, payload, { headers }); // Exibe o status e a resposta console.log('HTTP Code:', response.status); console.log('Response:', response.data); } catch (error) { console.error('Erro:', error.message); } })(); ``` -------------------------------- ### Payment Plan Request Example Source: https://dom-pagamentos.readme.io/reference/criar-plano This example shows the structure of a request to create a payment plan. ```json { "description": "Plano Ouro", "value": 58.99, "external_reference": "OURO-001", "frequency": 1, "frequency_type": "MONTH", "repetitions": 0, "payment_methods": [ "credit_card" ], "installments": [ 1 ], "billing_type": "prepaid", "billing_day": 0, "retry_days": 3 } ``` -------------------------------- ### Activate Subscription Request Example Source: https://dom-pagamentos.readme.io/reference/clientes-copy Example of activating a subscription using its ID and providing a reason for reactivation. ```json { "reason": "Customer requested reactivation." } ``` -------------------------------- ### Create Subscription Example Source: https://dom-pagamentos.readme.io/reference/clientes Example JSON payload for creating a new subscription with auto-recurring payment details. ```json { "reason": "Solicitado pelo cliente" } ``` -------------------------------- ### Get Subscription Response Example Source: https://dom-pagamentos.readme.io/reference/clientes-copy This snippet illustrates a typical response when retrieving subscription details. It includes identifiers, customer and plan information, auto-recurring settings, payment details, status, and timestamps. ```json { "id": "389ffa5a-c95b-4258-927a-d48cc6829ca3", "customer_id": "4bfc6124-ceee-4f6f-9f29-75059b3f5d9c", "plan_id": "", "external_reference":"Assinatura 001", "auto_recurring": { "description": "Plano Ouro", "value": 58.99, "frequency" : 1, "frequency_type": "MONTH", "repetitions": 0, "billing_type": "prepaid", "billing_day":0, "trial_period_days":0, "retry_days": 3 }, "payment_method": "credit_card", "card":{ "installments":1, "token": "2c2b1bf5085716225061bb09e1d6df1094239e64efa737b9f6b3aed00c3011fc" }, "cashback_active":false, "postbackurl": "https://seudominio.com.br/webhook", "metadata": "{'meta':'ok'}", "current_cycle": 1, "start_date_invoice": "2024-10-10", "next_date_invoice": "2024-10-10", "end_date_invoice": "", "status": "active", "created_at": "2024-10-01T16:00:00Z", "updated_at": "2019-10-01T17:00:00Z", "platform": [ ``` -------------------------------- ### Create Subaccount Example Source: https://dom-pagamentos.readme.io/reference/clientes-copy Example of a request body to create a new subaccount with detailed financial and partner information. ```json { "name": "Subconta 01", "external_reference": "1234", "address": { "street": "Rua da Subconta", "number": "100", "neighborhood": "Centro", "zip_code": "0000000", "city": "Florianópolis", "state": "SC" }, "partner_adm": { "name": "Administrador", "doc": "12345678911", "birthdate": null, "email": "subconta@subconta.com", "phone": null }, "support": { "phone": "4899999999", "email": "subconta@subconta.com", "site": null }, "financial_pixout": { "key": "11111111111111", "type": "CNPJ" }, "status": "APPROVED", "msg": "", "credentials": { "public_key": "pk_490fcabb-5101-gd45-a5ee-2659ea9d793i", "token": "f92b*******************29a523" }, "created_at": "2025-02-20T10:39:13Z", "updated_at": "2025-02-20T10:39:13Z" } ``` -------------------------------- ### Failure Response Example (Subaccount Not Found) Source: https://dom-pagamentos.readme.io/reference/alterar-modo-de-repasse This example shows the response when the specified subaccount cannot be found. ```json { "status": "FAIL", "msg": "Subconta não encontrada" } ``` -------------------------------- ### Create Plan API Request Example Source: https://dom-pagamentos.readme.io/reference/planos Example request body for creating a new payment plan with specific configurations. ```json { "description": "Plano Ouro", "value": 58.99, "external_reference": "OURO-001", "frequency" : 1, "frequency_type": "MONTH", "repetitions": 0, "payment_methods": [ "credit_card" ], "installments": [ 1 ], "billing_type": "prepaid", "billing_day":0, "ret ``` -------------------------------- ### Cashback Query No Records Found Example Source: https://dom-pagamentos.readme.io/reference/consulta-cashback Example response when no cashback records are found for the specified consumer. ```json { "status": "FAIL", "msg": "Nenhum registro localizado!" } ``` -------------------------------- ### Create Customer Payload Example Source: https://dom-pagamentos.readme.io/reference/clientes Example payload for creating a customer, including basic contact and identification details. ```json { "cod_external": "string", "customer": { "name": "string", "email": "string", "mobile_phone": "string", "document": "string", "document_type": "string", "birthdate": "2020-12-31", "gender": "string" } } ``` -------------------------------- ### Cancel Subscription Example Source: https://dom-pagamentos.readme.io/reference/cancelar-assinatura This example shows the structure of a successful response when canceling a subscription. It includes details of the subscription that was canceled. ```json { "id": "389ffa5a-c95b-4258-927a-d48cc6829ca3", "customer_id": "4bfc6124-ceee-4f6f-9f29-75059b3f5d9c", "plan_id": "", "external_reference":"Assinatura 001", "auto_recurring": { "description": "Plano Ouro", "value": 58.99, "frequency" : 1, "frequency_type": "MONTH", "repetitions": 0, "billing_type": "prepaid", "billing_day":0, "retry_days": 3 }, "payment_method": "credit_card", "card":{ "installments":1, "token": "2c2b1bf5085716225061bb09e1d6df1094239e64efa737b9f6b3aed00c3011fc" }, "cashback_active":false, "postbackurl": "https://seudominio.com.br/webhook", "metadata": "{'meta':'ok'}", "current_cycle": 1, "start_date_invoice": "2024-10-10", "next_date_invoice": "2024-10-10", "end_date_invoice": "", "status": "canceled", "created_at": "2024-10-01T16:00:00Z", "updated_at": "2019-10-01T17:00:00Z", "platform": [ { "fee_details": { "fee_transaction": { "type": "variable", "value": 10 }, "fee_cashback": { "type": "fixed", "value": 5 } } } ] } ``` -------------------------------- ### Empty Response Example Source: https://dom-pagamentos.readme.io/reference/criar-plano This example shows an empty JSON object as a response, potentially indicating an error or no data. ```json {} ``` -------------------------------- ### Tokenization Example - HTML/JavaScript Source: https://dom-pagamentos.readme.io/reference/tokenizacao This example demonstrates how to use the `getTokenCard` function to obtain a token, brand, and BIN for a credit card transaction. It includes form fields to capture these details and submit them. Ensure the SDK is loaded before this script runs. ```html
``` -------------------------------- ### Get Customer Response Body Source: https://dom-pagamentos.readme.io/reference/clientes Example JSON response when successfully retrieving a customer's details using their ID. ```json { "id": "4bfc6124-ceee-4f6f-9f29-75059b3f5d9c", "name": "João da Silva", "email": "joao@dopagamentos.com", "code_external": "REF_CUSTOMER_001", "document": "11111111111", "document_type": "CPF", "gender": "male", "address": { "street": "Av. General", "number": "s/n", "neighborhood":"Centro", "zip_code": "88036200", "city": "Florianópolis" }, "birthdate": "1981-06-01", "mobile_phone": "48999999999" } ``` -------------------------------- ### Get Customer Success Response Source: https://dom-pagamentos.readme.io/reference/assinaturas Example of a successful response when retrieving customer details. Includes customer information and associated card tokens. ```json { "id": "4bfc6124-ceee-4f6f-9f29-75059b3f5d9c", "name": "João da Silva", "email": "joao@dopagamentos.com", "code_external": "REF_CUSTOMER_001", "document": "11111111111", "document_type": "CPF", "gender": "male", "address": { "street": "Av. General", "number": "s/n", "neighborhood":"Centro", "zip_code": "88036200", "city": "Florianópolis", "state": "SC" }, "cards_tokens": [ { "token": "65432f17bd804123456789abcdefghijklmno", "last_4_digits": "1234", "brand": "mastercard", "holder_name": "Joao da Silva", "expire": "12/2035", "exp_month": "12", "exp_year": "2035", "active": "Y" } ], "status": "active", "created_at": "2024-10-01T15:36:00Z", "updated_at": "2024-10-01T15:36:00Z", "birthdate": "1981-06-01", "mobile_phone": "48999999999", "status":"active" } ``` -------------------------------- ### Consultar Plano Example Source: https://dom-pagamentos.readme.io/reference/consultar-plano This example shows the expected JSON response when successfully consulting a plan. It includes details like plan ID, description, value, recurrence settings, and status. ```json { "id": "6fd5256a-8299-471b-be45-2016ff6bc548", "description": "Plano Ouro", "value": 58.99, "external_reference": "OURO-001", "frequency" : 1, "frequency_type": "MONTH", "repetitions": 0, "payment_methods": [ "credit_card" ], "installments": 3, "billing_type": "prepaid", "billing_day":0, "trial_period_days":0, "retry_days": 3, "status": "active", "created_at": "2024-10-01T16:00:00Z", "updated_at": "2019-10-01T17:00:00Z" } ``` -------------------------------- ### Customer Creation Response Example (200 OK) Source: https://dom-pagamentos.readme.io/reference/criar-cliente This example shows a successful response when a customer is created. It includes all customer details. ```json { "id": "4bfc6124-ceee-4f6f-9f29-75059b3f5d9c", "name": "João da Silva", "email": "joao@dopagamentos.com", "code_external": "REF_CUSTOMER_001", "document": "11111111111", "document_type": "CPF", "gender": "male", "address": { "street": "Av. General", "number": "s/n", "neighborhood":"Centro", "zip_code": "88036200", "city": "Florianópolis", "state": "SC" }, "status": "active", "created_at": "2024-10-01T15:36:00Z", "updated_at": "2024-10-01T15:36:00Z", "birthdate": "1981-06-01", "mobile_phone": "48999999999", "status":"active" } ``` -------------------------------- ### Get EDI Transactions Source: https://dom-pagamentos.readme.io/reference/subcontas Retrieves EDI transaction data, allowing filtering by type, start date, and end date. Requires an Authorization header. ```APIDOC ## GET /edi/transactions ### Description Retrieves EDI transaction data, with options to filter by transaction type and date range. ### Method GET ### Endpoint /edi/transactions ### Parameters #### Query Parameters - **type** (string) - Required - Period of transactions: 'order' (purchase date) or 'settlement' (liquidation date). - **date_start** (datetime) - Required - Initial search date (Y-m-d H:m:s). - **date_end** (string) - Required - Final search date (Y-m-d H:m:s). #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request (e.g., "OK"). - **total** (string) - The total number of transactions found. - **data** (array) - An array of transaction objects. - **id** (string) - The unique identifier for the transaction. - **code_external** (string) - The external code for the transaction. - **status** (string) - The status of the transaction (e.g., "Pendente"). - **date** (string) - The date of the transaction. - **date_liquid** (string) - The liquidation date. - **installments** (string) - The number of installments. - **total** (string) - The total amount. - **total_liquid** (string) - The net total amount. - **cost** (string) - The cost associated with the transaction. #### Response Example (200) ```json { "status": "OK", "total": "2", "data": [ { "id": "b621bd00-dfc9-11ee-8444-cc5ef8b5abab", "code_external": "546sdf6545", "status": "Pendente", "date": "2023-07-05 15:53:33", "date_liquid": "2023-07-06", "installments": "1", "total": "117.8", "total_liquid": "108.57", "cost": "9.230000000000004" }, { "id": "b621c25f-dfc9-11ee-8444-cc5ef8b5abab", "code_external": "458479842", "status": "Pendente", "date": "2023-07-05 15:53:33", "date_liquid": "2023-07-06", "installments": "1", "total": "117.8", "total_liquid": "108.57", "cost": "9.230000000000004" } ] } ``` #### Error Response (400) ```json { "status": "FAIL", "msg": "Descrição do erro." } ``` ``` -------------------------------- ### List Subaccounts Example Source: https://dom-pagamentos.readme.io/reference/listar-subcontas This example demonstrates how to list subaccounts. It includes query parameters for pagination and an Authorization header for authentication. The response shows the structure of the returned subaccount data. ```json { "openapi": "3.1.0", "info": { "title": "Dom Pagamentos", "version": "3.0" }, "servers": [ { "url": "{apiUrl}", "variables": { "apiUrl": { "default": "apiUrl" } } } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "name": "Authorization", "in": "header", "x-bearer-format": "bearer", "x-default": "authToken" } } }, "security": [ { "sec0": [] } ], "paths": { "/subaccount": { "get": { "summary": "Listar subcontas", "description": "Retorna uma lista de subcontas", "operationId": "listar-subcontas", "parameters": [ { "name": "page", "in": "query", "description": "Página buscada", "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "Authorization", "in": "header", "description": "token da privada da plataforma", "schema": { "type": "string", "default": "Bearer" } }, { "name": "limit", "in": "query", "description": "Limite de itens retornados por página (limite máximo de 100)", "schema": { "type": "integer", "format": "int32", "default": 100 } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"total\": 1,\n \"per_page\": 100,\n \"page\": \"1\",\n \"total_pages\": 1,\n \"data\": [\n {\n \"id\": \"26e1d2bf-26f4-4611-b6b8-0efd6563a23g\",\n \"corporate_doc\": \"11111111111111\",\n \"corporate_name\": \"Subconta 01 Ltda\",\n \"name\": \"subconta 01\",\n \"external_reference\": \"1234\",\n \"address\": {\n \"street\": \"Rua da Subconta\",\n \"number\": \"100\",\n \"neighborhood\": \"Centro\",\n \"zip_code\": \"0000000\",\n \"city\": \"Florianópolis\",\n \"state\": \"SC\"\n },\n \"partner_adm\": {\n \"name\": \"Administrador\",\n \"doc\": \"12345678911\",\n \"birthdate\": null,\n \"email\": \"subconta@subconta.com\",\n \"phone\": null\n },\n \"support\": {\n \"phone\": \"4899999999\",\n \"email\": \"subconta@subconta.com\",\n \"site\": null\n },\n \"financial_pixout\": {\n \"key\": \"11111111111111\",\n \"type\": \"CNPJ\"\n },\n \"status\": \"APPROVED\",\n \"msg\": \"\",\n \"credentials\": {\n \"public_key\": \"pk_490fcabb-5101-gd45-a5ee-2659ea9d793i\",\n \"token\": \"f92b*******************29a523\"\n },\n \"created_at\": \"2025-02-20T10:39:13Z\",\n \"updated_at\": \"2025-02-20T10:39:13Z\"\n }\n ]\n}" } }, "schema": { "type": "object", "properties": { "total": { "type": "integer", "example": 1, "default": 0 }, "per_page": { "type": "integer", "example": 100, "default": 0 }, "page": { "type": "string", "example": "1" }, "total_pages": { "type": "integer", "example": 1, "default": 0 }, "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "example": "26e1d2bf-26f4-4611-b6b8-0efd6563a23g" }, "corporate_doc": { "type": "string", "example": "11111111111111" }, "corporate_name": { "type": "string", "example": "Subconta 01 Ltda" }, "name": { "type": "string", "example": "subconta 01" }, "external_reference": { "type": "string", "example": "1234" }, "address": { "type": "object", "properties": { "street": { "type": "string", "example": "Rua da Subconta" }, "number": { "type": "string", "example": "100" }, "neighborhood": { "type": "string", "example": "Centro" }, "zip_code": { "type": "string", "example": "0000000" }, "city": { "type": "string", "example": "Florianópolis" }, "state": { "type": "string", "example": "SC" } } }, "partner_adm": { "type": "object", "properties": { "name": { "type": "string", "example": "Administrador" }, "doc": { "type": "string", "example": "12345678911" }, "birthdate": { "type": "string", "example": null }, "email": { "type": "string", "example": "subconta@subconta.com" }, "phone": { "type": "string", "example": null } } }, "support": { "type": "object", "properties": { "phone": { "type": "string", "example": "4899999999" }, "email": { "type": "string", "example": "subconta@subconta.com" }, "site": { "type": "string", "example": null } } }, "financial_pixout": { "type": "object", "properties": { "key": { "type": "string", "example": "11111111111111" }, "type": { "type": "string", "example": "CNPJ" } } }, "status": { "type": "string", "example": "APPROVED" }, "msg": { "type": "string", "example": "" }, "credentials": { "type": "object", "properties": { "public_key": { "type": "string", "example": "pk_490fcabb-5101-gd45-a5ee-2659ea9d793i" }, "token": { "type": "string", "example": "f92b*******************29a523" } } }, "created_at": { "type": "string", "example": "2025-02-20T10:39:13Z" }, "updated_at": { "type": "string", "example": "2025-02-20T10:39:13Z" } } } } } } } } } } } } } } ``` -------------------------------- ### Get Card Token with React + TypeScript Source: https://dom-pagamentos.readme.io/reference/three_ds Integrate card tokenization within a React component using TypeScript. This example demonstrates loading the SDK and calling `getTokenCard` to obtain payment details. ```typescript // DomPagamentoForm.tsx import React, { useState, useEffect, useRef } from 'react'; declare global { interface Window { getTokenCard: ( publicKey: string, cardData: any, installments: number, callback: (data: any) => void ) => void; module?: any; } } const DomPagamentoForm: React.FC = () => { const formRef = useRef