payment / pix.html
Cbteam's picture
interbanco brazil pix payment reciept generator
82af887 verified
Raw
History Blame Contribute Delete
19.3 kB
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BankSlip Bot - PIX Receipt Generator</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#2563eb',
secondary: '#7c3aed',
pix: '#32BCAD'
}
}
}
}
</script>
<style>
.receipt-paper {
background-image: linear-gradient(to bottom, #f9f9f9 1px, transparent 1px);
background-size: 100% 24px;
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.perforation {
background: repeating-linear-gradient(180deg, #e5e7eb, #e5e7eb 10px, transparent 10px, transparent 20px);
}
.pix-logo {
filter: brightness(0) saturate(100%) invert(68%) sepia(45%) saturate(508%) hue-rotate(122deg) brightness(92%) contrast(90%);
}
.watermark {
opacity: 0.05;
pointer-events: none;
}
.qr-placeholder {
background: linear-gradient(135deg, #f3f4f6 25%, #e5e7eb 25%, #e5e7eb 50%, #f3f4f6 50%, #f3f4f6 75%, #e5e7eb 75%, #e5e7eb 100%);
background-size: 40px 40px;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto py-12 px-4">
<header class="flex flex-col items-center mb-8">
<h1 class="text-3xl font-bold text-primary mb-2">BankSlip Bot</h1>
<p class="text-gray-600">Gerador de comprovante PIX</p>
</header>
<main class="flex flex-col lg:flex-row gap-8">
<!-- Form Section -->
<div class="w-full lg:w-1/2 bg-white rounded-xl shadow-md p-6">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Dados do PIX</h2>
<form id="pixForm" class="space-y-4">
<!-- Pagador Section -->
<div>
<h3 class="text-md font-medium text-gray-700 mb-2 flex items-center">
<i data-feather="user" class="w-4 h-4 mr-2"></i> Dados do Pagador
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Nome Completo</label>
<input type="text" id="payerName" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">CPF/CNPJ</label>
<input type="text" id="payerId" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
</div>
</div>
<!-- Payment Section -->
<div>
<h3 class="text-md font-medium text-gray-700 mb-2 flex items-center">
<i data-feather="dollar-sign" class="w-4 h-4 mr-2"></i> Dados do Pagamento
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Valor (R$)</label>
<input type="number" id="amount" step="0.01" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Chave PIX</label>
<select id="pixType" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<option value="CPF">CPF</option>
<option value="CNPJ">CNPJ</option>
<option value="Celular">Celular</option>
<option value="Email">E-mail</option>
<option value="Aleatoria">Aleatória</option>
</select>
</div>
</div>
<div class="mt-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Identificador</label>
<input type="text" id="pixKey" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
<div class="mt-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Descrição</label>
<input type="text" id="description"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
</div>
<!-- Bank Details -->
<div>
<h3 class="text-md font-medium text-gray-700 mb-2 flex items-center">
<i data-feather="bank" class="w-4 h-4 mr-2"></i> Dados Bancários
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Banco</label>
<select id="bankName" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<option value="Banco do Brasil">Banco do Brasil</option>
<option value="Bradesco">Bradesco</option>
<option value="Itaú">Itaú</option>
<option value="Santander">Santander</option>
<option value="Caixa">Caixa Econômica</option>
<option value="Nubank">Nubank</option>
<option value="Inter">Banco Inter</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Tipo de Conta</label>
<select id="accountType" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<option value="Conta Corrente">Conta Corrente</option>
<option value="Conta Poupança">Conta Poupança</option>
<option value="Conta Salário">Conta Salário</option>
</select>
</div>
</div>
</div>
<div class="pt-4">
<button type="submit" class="w-full bg-pix hover:bg-green-600 text-white font-medium py-2 px-4 rounded-md transition duration-300">
Gerar Comprovante
</button>
</div>
</form>
</div>
<!-- Preview Section -->
<div class="w-full lg:w-1/2 flex flex-col">
<div class="bg-white rounded-xl shadow-md overflow-hidden mb-4">
<div class="perforation h-6 w-full"></div>
<div id="pixPreview" class="receipt-paper p-8 relative">
<div class="watermark absolute inset-0 flex items-center justify-center font-bold text-6xl text-gray-300 -rotate-45">
PIX
</div>
<div class="relative z-10">
<!-- Header -->
<div class="flex justify-between items-start mb-8">
<div>
<h2 class="text-2xl font-bold text-pix">COMPROVANTE PIX</h2>
<p class="text-gray-500 text-sm">Transação #<span id="previewId">PIX-12345</span></p>
</div>
<div class="text-right">
<p class="text-gray-600 text-sm">Data: <span id="previewDate">DD/MM/YYYY</span></p>
<p class="text-gray-600 text-sm">Hora: <span id="previewTime">HH:MM</span></p>
</div>
</div>
<!-- QR Code -->
<div class="flex flex-col items-center mb-8">
<div class="qr-placeholder w-48 h-48 mb-4 flex items-center justify-center">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=PIXEXAMPLE" id="qrCode" class="w-full h-full">
</div>
<div class="text-center">
<p class="text-sm text-gray-600 mb-1">Chave PIX: <span id="previewPixKey">123.456.789-09</span></p>
<p class="text-sm text-gray-600">Tipo: <span id="previewPixType">CPF</span></p>
</div>
</div>
<!-- Payer Info -->
<div class="mb-6">
<h4 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">Pagador</h4>
<p class="font-medium" id="previewPayer">Nome do Pagador</p>
<p class="text-gray-600 text-sm" id="previewPayerId">CPF/CNPJ: 123.456.789-09</p>
</div>
<!-- Payment Details -->
<div class="mb-6">
<h4 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">Pagamento</h4>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Valor:</span>
<span class="font-bold" id="previewAmount">R$ 1.000,00</span>
</div>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Descrição:</span>
<span class="font-medium" id="previewDescription">Pagamento de serviço</span>
</div>
</div>
<!-- Bank Info -->
<div class="mb-6">
<h4 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">Banco Destino</h4>
<div class="flex items-center">
<div class="mr-4">
<div class="pix-logo bg-gray-200 w-12 h-12 rounded flex items-center justify-center">
<i data-feather="dollar-sign" class="w-6 h-6 text-pix"></i>
</div>
</div>
<div>
<p class="font-medium" id="previewBank">Banco</p>
<p class="text-gray-600 text-sm" id="previewAccountType">Tipo: Conta Corrente</p>
</div>
</div>
</div>
<!-- Status -->
<div class="mt-8 pt-4 border-t border-gray-200">
<div class="flex justify-between items-center">
<div class="text-sm text-gray-500">
<p>Status:</p>
<p class="font-medium mt-2 text-green-600">Pagamento concluído</p>
</div>
<div class="flex items-center">
<div class="mr-2 h-8 w-8 bg-gray-200 rounded-full flex items-center justify-center">
<i data-feather="check" class="w-4 h-4 text-green-500"></i>
</div>
<span class="text-sm text-gray-600">Confirmado</span>
</div>
</div>
</div>
</div>
</div>
<div class="perforation h-6 w-full"></div>
</div>
<!-- Actions -->
<div class="flex gap-4">
<button id="downloadPixBtn" class="flex-1 bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 font-medium py-2 px-4 rounded-md transition duration-300 flex items-center justify-center gap-2 opacity-50 cursor-not-allowed" disabled>
<i data-feather="download" class="w-4 h-4"></i>
Baixar PDF
</button>
<button id="printPixBtn" class="flex-1 bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 font-medium py-2 px-4 rounded-md transition duration-300 flex items-center justify-center gap-2">
<i data-feather="printer" class="w-4 h-4"></i>
Imprimir
</button>
</div>
</div>
</main>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
feather.replace();
// Set current date and time
const now = new Date();
document.getElementById('previewDate').textContent = now.toLocaleDateString('pt-BR');
document.getElementById('previewTime').textContent = now.toLocaleTimeString('pt-BR', {hour: '2-digit', minute:'2-digit'});
// Generate random transaction ID
document.getElementById('previewId').textContent = 'PIX-' + Math.floor(Math.random() * 1000000).toString().padStart(6, '0');
// Form submission
document.getElementById('pixForm').addEventListener('submit', function(e) {
e.preventDefault();
// Get form values
const payerName = document.getElementById('payerName').value;
const payerId = document.getElementById('payerId').value;
const amount = parseFloat(document.getElementById('amount').value).toLocaleString('pt-BR', {
style: 'currency',
currency: 'BRL'
});
const pixType = document.getElementById('pixType').value;
const pixKey = document.getElementById('pixKey').value;
const description = document.getElementById('description').value || "Nenhuma descrição fornecida";
const bankName = document.getElementById('bankName').value;
const accountType = document.getElementById('accountType').value;
// Update preview
document.getElementById('previewPayer').textContent = payerName;
document.getElementById('previewPayerId').textContent = `${pixType === 'CPF' ? 'CPF' : 'CNPJ'}: ${formatId(payerId)}`;
document.getElementById('previewAmount').textContent = amount;
document.getElementById('previewDescription').textContent = description;
document.getElementById('previewBank').textContent = bankName;
document.getElementById('previewAccountType').textContent = `Tipo: ${accountType}`;
document.getElementById('previewPixType').textContent = pixType;
document.getElementById('previewPixKey').textContent = pixKey;
document.getElementById('qrCode').src = `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=PIX:${pixKey}`;
// Enable download button
document.getElementById('downloadPixBtn').disabled = false;
document.getElementById('downloadPixBtn').classList.remove('opacity-50', 'cursor-not-allowed');
// Scroll to preview
document.getElementById('pixPreview').scrollIntoView({ behavior: 'smooth' });
});
// Print button
document.getElementById('printPixBtn').addEventListener('click', function() {
window.print();
});
// Download button (placeholder functionality)
document.getElementById('downloadPixBtn').addEventListener('click', function() {
alert('Geração de PDF seria implementada em ambiente de produção');
});
// Format CPF/CNPJ
function formatId(id) {
if (id.length === 11) { // CPF
return id.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4');
} else if (id.length === 14) { // CNPJ
return id.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5');
}
return id;
}
});
</script>
</body>
</html>