khipu_pay 0.0.2

KhipuPay #

A Flutter plugin that uses Khipu libraries to process payments in applications developed with Flutter

This plugin also has support to create payment identifiers and validate payment status.

AndroidManifest changes #

To use the plugin on Android, you must modify the android: name of application, since you need to have an instance of KhenshinInterface

<application
    android:name="io.flutter.app.FlutterApplication"

to

<application
    android:name="com.duckytie.khipupay.KhipuApplication"

This change will not change the normal functionality of your application, since the KhipuApplication class also extends from FlutterApplication

Podfile changes #

Remove use_frameworks! of Podfile, to avoid conflicts with Khipu bookstore

target 'Runner' do
  use_frameworks!

Add Color in colors.xml #

<color name="khenshin_primary">#ca0814</color> <!-- Navigation bar color and main button -->
<color name="khenshin_primary_dark">#580409</color> <!-- Color of the top status bar -->
<color name="khenshin_primary_text">#ffffff</color> <!-- Text color in the navigation bar -->
<color name="khenshin_accent">#ca0814</color> <!-- Color of the decorations, for example progress bars -->

On iOS, the color of Khipu is set in the initialize method

void main() {
  runApp(MyApp());
  KhipuPay.initialize(hexaColor: "e5be01");
}

*IMPORTANT: The hexadecimal color to configure in iOS, is still in development.

How to use the plugin #

  1. To generate a payment identifier, you must submit the fields required by Khipu, the email field is not mandatory.
import 'package:khipu_pay/khipu_payment.dart';

String idPayment = await KhipuPayment().getPaymentId(
    id: "id_cobrador", //Information delivered by khipu
    secret: "secret", //Information delivered by khipu
    subject: "asunto del pago",
    amount: "1000", //This value must be greater than 0
    currency: "CLP",
    email: "correo@correo.cl",
);
  1. Once the payment identifier is generated, you can process the payment by Khipu, it will return a "SUCCESS" if the transaction was correct or a "FAILURE" if the transaction fails or is canceled.
import 'package:khipu_pay/khipu_pay.dart';

String statusProcess = await KhipuPay.paymentProcess(paymentId: idPayment);
  1. Before or after making the payment, you can check the status of the generator identifier.
import 'package:khipu_pay/khipu_payment_status.dart';

String statusPayment = await KhipuPaymentStatus().status(
    transactionCode: idPayment,
    id: "id_cobrador", //Information delivered by khipu
    secret: "secret", //Information delivered by khipu
);

Remember that Khipu provides id and secret for development and production environment, you must change these fields, depending on the environment in which your application is located, so that you can process your payments correctly.

0.0.2 #

  • More description in example project
  • Now it works on Android and iOS
  • Validation of mandatory fields

0.0.1 #

  • Payment ID generators
  • Make payments
  • Check the payment status
  • Compatible with flutter version <= 1.12.0

example/README.md

KhipuPay Example #

Demonstrates how to use the khipu_pay plugin.

Getting Started #

  1. To generate a payment identifier, you must submit the fields required by Khipu, the email field is not mandatory.
import 'package:khipu_pay/khipu_payment.dart';

String idPayment = await KhipuPayment().getPaymentId(
    id: "id_cobrador", //Information delivered by khipu
    secret: "secret", //Information delivered by khipu
    subject: "asunto del pago",
    amount: "1000", //This value must be greater than 0
    currency: "CLP",
    email: "correo@correo.cl",
);
  1. Once the payment identifier is generated, you can process the payment by Khipu, it will return a "SUCCESS" if the transaction was correct or a "FAILURE" if the transaction fails or is canceled.
import 'package:khipu_pay/khipu_pay.dart';

String statusProcess = await KhipuPay.paymentProcess(paymentId: idPayment);
  1. Before or after making the payment, you can check the status of the generator identifier.
import 'package:khipu_pay/khipu_payment_status.dart';

String statusPayment = await KhipuPaymentStatus().status(
    transactionCode: idPayment,
    id: "id_cobrador", //Information delivered by khipu
    secret: "secret", //Information delivered by khipu
);

Remember that Khipu provides id and secret for development and production environment, you must change these fields, depending on the environment in which your application is located, so that you can process your payments correctly.

Use this package as a library

1. Depend on it

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


dependencies:
  khipu_pay: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:khipu_pay/khipu_pay.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
37
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
crypto ^2.1.3 2.1.4
cryptoutils ^0.4.0 0.4.0
diacritic ^0.1.1 0.1.1
flutter 0.0.0
http ^0.12.0+3 0.12.0+4
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test