picpay 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 70

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.

Changelog #

1.0.1 #

  • Lint

1.0.0 #

  • Initial version

example/picpay_example.dart

import 'package:picpay/picpay.dart';

void main() async {
  var token = '5b008f2367b2-1399-4e53-5b008c-5b008cef';

  var buyer = PicPayBuyer(
    "Luiz",
    "Eduardo",
    "123.345.678.99",
    "luizeof@gmail.com",
    "+551212345678",
  );

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

  print(payment.paymentUrl);

  print(payment.qrcodeContent);

  print(payment.qrcodeImage);

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

  print(paymentStatus.status);

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

  print(paymentCancel.isRequestSuccess);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  picpay: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:picpay/picpay.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Mar 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
http ^0.12.0+4 0.12.0+4
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.6.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
effective_dart ^1.0.0
pedantic any 1.9.0