pagseguro_payment_tech 2.0.1
pagseguro_payment_tech: ^2.0.1 copied to clipboard
Integre o Flutter com maquinas smarts da Pagseguro, utilizando o SDK do Pagseguro. Rápido e fácil.
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 #
PagseguroPaymentTech.initPayment(
handler: controller,
);
PagseguroPaymentTech.initNfc(
handler: nfcHandler,
);
A partir da versão 2.0.0 é necessário adicionar as chaves no seu arquivo local.properties na raiz da pasta android.
licenceKey=<sua_licenca>
licenceInternalKey=aHR0cHM6Ly9wb3MtcGF5bWVudHMtYXBpLTU3NzQ2NDIzNTQwOC5zb3V0aGFtZXJpY2EtZWFzdDEucnVuLmFwcC9wb3MtcGF5bWVudHMvbGljZW5jZS9jaGVjay9pbnZvaWNl
🚀 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 aprovadaonError(String)— Erro na transaçãoonMessage(String)— Mensagem da PagSeguroonTransactionInfo(...)— Detalhes da transaçãowriteToFile(...)— 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 #
PagseguroPaymentTech.initNfc(
handler: SeuNfcHandler(),
);
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();
Pagina automatizada #
final result = await Navigator.push<PagseguroResponseModel?>(
context,
MaterialPageRoute(
builder: (context) => PagseguroPage(
params: PagseguroPageParams(
amount: 100,
type: PagseguroPaymentType.credit,
options: PagseguroOptions(
activationCode: '123456',
isPrinterEstablishment: false,
),
),
),
),
);
Neste exemplo acima a váriavel result é do tipo PagseguroResponseModel.
|
JY Labtech |