Skip to content

stackingwidgets/picpay-dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PicPay

A PicPay library for Dart developers based on e-Commerce Public API (1.0).

Usage

A simple usage example:

Create your PicPay Token

Create your PicPay Token on your PicPay E-Commerce Account.

  final String token = '5b008f2367b2-1399-5b008cef';

Create a Buyer

import 'package:picpay/picpay.dart';

void main() async {

  // Create a PicPay Buyer
  var buyer = PicPayBuyer(
    "Luiz",
    "Eduardo",
    "123.345.678.99",
    "luizeof@gmail.com",
    "+551212345678",
  );

}

Create Payment

import 'package:picpay/picpay.dart';

void main() async {

  var token = '5b008f2367b2-1399-5b008cef';

  // Create a Payment
  var payment = await PicPayPayment.create(
    token,
    "9999999",
    'https://retorno.seusite.com.br',
    10,
    buyer,
  );

  // Buyer Payment URL
  print(payment.paymentUrl);

  // Buyer Payment QRCode Content
  print(payment.qrcodeContent);

  // Buyer Payment QRCode Image encoded with Base64
  print(payment.qrcodeImage);

}

Check Payment Status

import 'package:picpay/picpay.dart';

void main() async {

  var token = '5b008f2367b2-1399-5b008cef';

  var paymentStatus = await PicPayPaymentStatus.create(token, "1234");

  // Return Payment Status Text
  print(paymentStatus.status);

  // You can also check status using:

  paymentStatus.isCreated;

  paymentStatus.isExpired;

  paymentStatus.isAnalysis;

  paymentStatus.isPaid;

  paymentStatus.isCompleted;

  paymentStatus.isRefunded;

  paymentStatus.isChargeback;

}

Cancel Payment

import 'package:picpay/picpay.dart';

void main() async {

  var token = '5b008f2367b2-1399-5b008cef';

  var paymentCancel = await PicPayCancelPayment.create(token, "1234");

  print(paymentCancel.isRequestSuccess);

}

Features and bugs

Please file feature requests and bugs at the issue tracker.