stripe_fl 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 54

stripe_fl #

Build Status

stripe #

A native Dart SDK for Stripe.

Documentation #

Initializing

import 'package:stripe_fl/stripe_fl.dart';
      Stripe.init(
        production: false,
        publicKey: 'PUBLIC_KEY',
        secretKey: 'SECRET_KEY',
        useLogger: true);

Generating Charge Tokens

    Response<CardToken> cardObject = await Tokenize().card(
    cvc: 'cvc',
    expiryMonth: month,
    expiryYear: year,
    number: 'number',
    name: 'full name',
    phone: 'phone ');

Response #

CardToken {
  id=tok_1FqzkhDiaj1muI06cZdNlXCt,
  object=token,
  card=Card {
    id=card_1FqzkhDiaj1muI06aHc1QnaR,
    object=card,
    addressLine1=2348113823269,
    addressLine1Check=unchecked,
    brand=Visa,
    country=US,
    cvcCheck=unchecked,
    expMonth=12,
    expYear=2020,
    fingerprint=yyJwu2A8pzbrjay0,
    funding=credit,
    name=Ogbonda Chiziaruhoma,
  },
  clientIp=41.203.73.248,
  created=1576664855,
  livemode=false,
  type=card,
  used=false,
}}

#

Charging a card

    Response<ChargeResponse> chargeCard = await Charge().card(
            source: '',
            amount: 2000,
            description: 'Test Money Collected from chiiaruhoma@gmail.com',
            receiptEmail: 'chiziaruhoma@gmail.com');
ChargeResponse {
  id=ch_1FqzkiDiaj1muI06lPTc6C5x,
  object=charge,
  amount=2000,
  amountRefunded=0,
  balanceTransaction=txn_1FqzkjDiaj1muI06NZevC6vz,
  billingDetails=BillingDetails {
    address=Address {
      line1=2348113823269,
    },
    name=Ogbonda Chiziaruhoma,
  },
  captured=true,
  created=1576664856,
  currency=usd,
  description=Test Money Collected from chiiaruhoma@gmail.com,
  disputed=false,
  livemode=false,
  outcome=Outcome {
    networkStatus=approved_by_network,
    riskLevel=normal,
    riskScore=6,
    sellerMessage=Payment complete.,
    type=authorized,
  },
  paid=true,
  paymentMethod=card_1FqzkhDiaj1muI06aHc1QnaR,
  paymentMethodDetails=PaymentMethodDetails {
    creditCard=CreditCard {
      brand=visa,
      country=US,
      expMonth=12,
      expYear=2020,
      fingerprint=yyJwu2A8pzbrjay0,
      funding=credit,
      last4=4242,
      network=visa,
    },
    typ<…>
flutter: ChargeResponse {
  id=ch_1FqzkiDiaj1muI06lPTc6C5x,
  object=charge,
  amount=2000,
  amountRefunded=0,
  balanceTransaction=txn_1FqzkjDiaj1muI06NZevC6vz,
  billingDetails=BillingDetails {
    address=Address {
      line1=2348113823269,
    },
    name=Ogbonda Chiziaruhoma,
  },
  captured=true,
  created=1576664856,
  currency=usd,
  description=Test Money Collected from chiiaruhoma@gmail.com,
  disputed=false,
  livemode=false,
  outcome=Outcome {
    networkStatus=approved_by_network,
    riskLevel=normal,
    riskScore=6,
    sellerMessage=Payment complete.,
    type=authorized,
  },
  paid=true,
  paymentMethod=card_1FqzkhDiaj1muI06aHc1QnaR,
  paymentMethodDetails=PaymentMethodDetails {
    creditCard=CreditCard {
      brand=visa,
      country=US,
      expMonth=12,
      expYear=2020,
      fingerprint=yyJwu2A8pzbrjay0,
      funding=credit,
      last4=4242,
      network=visa,
    },
    type=card,
  },
  receiptUrl=<<https://pay.stripe.com/receipts/acct_1FMpnCDiaj1muI06/ch_1Fq<…>>>

Changelog #

0.1.0 #

  • Fixed Maintenance issues

0.0.1+4 #

  • Updated Documentation

0.0.1+2 #

  • Internal: Built basic transaction feature like charge and tokenize in to the dependency;

example/example.dart

import 'package:stripe_fl/stripe_fl.dart';

main() {
  load();
}

void load() async {
  try {
    var cardObject = await Tokenize().card(
        cvc: '123',
        expiryMonth: 12,
        expiryYear: 2020,
        number: '4242424242424242',
        name: 'Ogbonda Chiziaruhoma',
        phone: '2348113823269');

    print(cardObject?.data);

    if (cardObject?.data?.id != null) {
      var m = await Charge().card(
          source: cardObject?.data?.id,
          amount: 2000,
          description: 'Test Money Collected from chiiaruhoma@gmail.com',
          receiptEmail: 'chiziaruhoma@gmail.com');

      print(m?.data);
    }
  } catch (e) {
    print(e.toString());
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  stripe_fl: ^0.1.0

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:stripe_fl/stripe_fl.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
9
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]
54
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/utils/log.dart. (-0.50 points)

Analysis of lib/src/utils/log.dart reported 1 hint:

line 41 col 21: Unnecessary new keyword.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0-dev <3.0.0
built_collection ^4.3.0 4.3.2
built_value ^7.0.0 7.0.8
convert ^2.1.1 2.1.1
dio ^3.0.7 3.0.8
http ^0.12.0+2 0.12.0+4
meta ^1.1.8 1.1.8
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
fixnum 0.10.11
http_parser 3.1.3
matcher 0.12.6
path 1.6.4
quiver 2.1.2+1
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner ^1.7.2
built_value_generator ^7.0.0
pedantic ^1.8.0 1.9.0
test ^1.9.0
test_coverage