Pagseguro Payment Tech

PagSeguro

Sobre   |   Tecnologias   |   Configuração   |  


⚠️ Plugin não oficial!

🎯 Sobre

Este projeto visa facilitar a integração com o SDK PagSeguro Smart no Flutter. Compatível apenas com máquinas POS Smart da PagSeguro.

🔐 Licenciamento

Para adquirir uma licença, cadastre-se no site Licença JY Labtech.
Cada licença é válida por terminal. Após a compra, será gerada uma chave licenceKey vinculada ao terminal.

Inicialização com licença

await PagseguroPaymentTech.initPayment(
  handler: controller,
  licenceKey: 'SUA_CHAVE',
);

await PagseguroPaymentTech.initNfc(
  handler: nfcHandler,
  licenceKey: 'SUA_CHAVE',
);

🚀 Tecnologias

  • Flutter
  • PlugPagServiceWrapper (Android)

🏁 Configuração

pubspec.yaml

dependencies:
  pagseguro_payment_tech: any

Android Manifest

<uses-permission android:name="br.com.uol.pagseguro.permission.MANAGE_PAYMENTS"/>

Intent-filter

<intent-filter>
 <action android:name="br.com.uol.pagseguro.PAYMENT"/>
 <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

build.gradle (app level)

defaultConfig {
  applicationId "com.exemplo.pagamento"
  minSdkVersion 23
  targetSdkVersion flutter.targetSdkVersion
  ...
}

📦 Implementação

Criar Handler

class PaymentController extends PaymentHandler {
  // implementação omitida para brevidade
}

Métodos principais do Handler

  • onTransactionSuccess() — Transação aprovada
  • onError(String) — Erro na transação
  • onMessage(String) — Mensagem da PagSeguro
  • onTransactionInfo(...) — Detalhes da transação
  • writeToFile(...) — Personalizável

Iniciando transações

PagseguroPaymentTech.I.payment.activePinpad('CODIGO_ATIVACAO');

// Exemplos de pagamento:
PagseguroPaymentTech.I.payment.creditPayment(12.50);
PagseguroPaymentTech.I.payment.creditPaymentParc(1250, 2);
PagseguroPaymentTech.I.payment.debitPayment(12.50);
PagseguroPaymentTech.I.payment.pixPayment(12.50);
PagseguroPaymentTech.I.payment.voucherPayment(12.50);
PagseguroPaymentTech.I.payment.lastTransaction();

Estorno e cancelamento

PagseguroPaymentTech.I.payment.refund(
  transactionCode: controller.transactionCode,
  transactionId: controller.transactionId,
);

PagseguroPaymentTech.I.payment.abortTransaction();

Impressão

PagseguroPaymentTech.I.payment.printerfromFile('path/to/file.pdf');

PrintRenderWidget.print(
  context,
  pagseguroPaymentInstance: pagseguroPayment,
  child: MyCustomWidget(),
);

📡 NFC Smart

Inicialização

await PagseguroPaymentTech.initNfc(
  handler: SeuNfcHandler(),
  licenceKey: 'SUA_CHAVE',
);

Principais métodos NFC

await NfcSmart.instance.readNfc(idEvento);
await NfcSmart.instance.writeNfc(valor, nome, cpf, numeroTag, celular, aberto, idEvento);
await NfcSmart.instance.refundNfc(valor, idEvento);
await NfcSmart.instance.formatNfc();
await NfcSmart.instance.debitNfc(idEvento, valor);
await NfcSmart.instance.closeMethodCallHandler();
await NfcSmart.instance.lastTransaction();

JY Labtech

⬆️ Voltar ao topo