paylink_payment 1.0.4 copy "paylink_payment: ^1.0.4" to clipboard
paylink_payment: ^1.0.4 copied to clipboard

A Flutter Package designed to simplify the integration of Paylink's payment gateway into Flutter applications. It provides a streamlined way to handle payments within your app.

Paylink Payment Package #

Overview #

paylink_payment is a Flutter Package designed to simplify the integration of Paylink's payment gateway into Flutter applications. It provides a streamlined way to handle payments within your Flutter app.

Features #

  • Easy integration with Paylink payment gateway.
  • Simplified payment process with minimal code.
  • Secure handling of payment transactions.
  • The ability to checkout an invoice.
  • The ability to create a new invoice.
  • The ability to cancel invoice.
  • The ability to retrieve invoice details.

Usage #

To integrate Paylink's payment gateway into your Flutter application using the paylink_payment package, follow these steps:

  1. Install the Package:

    Add paylink_payment to your pubspec.yaml file under dependencies:

    dependencies:
      paylink_payment: ^1.0.4 # Use the latest version
    
  2. Import the Package:

    Import the paylink_payment package in your Dart file:

    import 'package:paylink_payment/paylink_payment.dart';
    
  3. Initialize Paylink instance

    paylink = PaylinkPayment(
      context: context,
      isTestMode: true,
      apiId: null, // required for production environment
      secretKey: null, // required for production environment
      webViewTitle: 'Payment Screen', // optional
      textColor: Colors.white, // optional
      themeColor: Colors.blue, // optional
    )
    
    • Replace the placeholders (apiId, secretKey, etc.) with actual values required for the production environment.

Package Functionalities #

1. Open Payment Form: #

Use the PaylinkPayment class to open the payment form when a button or action is triggered. Here's an example of how to do this:

// paylink instance initialized in previous step
paylink.openPaymentForm(
  transactionNo: '1713690519134',
  onPaymentComplete: (Map<String, dynamic> orderDetails) {
    /// Handle payment completion
  },
  onError: (Object error) {
    /// Handle payment error
  },
);
  • Implement the onPaymentComplete and onError callbacks to handle the payment completion and any errors that occur during the payment process. Customize these callbacks based on your app's requirements.

2. Add Invoice: #

paylink.addInvoice(
  amount: 220.0,
  clientMobile: '0512345678',
  clientName: 'Mohammed',
  orderNumber: '123456789',
  callBackUrl: 'https://example.com',
  products: [
    PaylinkProduct(title: 'Book', price: 100, qty: 2),
    PaylinkProduct(title: 'Pen', price: 2, qty: 10),
  ],
  cancelUrl: 'https://example.com',
  clientEmail: 'mohammed@test.com',
  currency: 'SAR',
  displayPending: true,
  note: 'Test invoice',
  smsMessage: 'URL: [SHORT_URL], Amount: [AMOUNT]',
  supportedCardBrands: ['mada', 'visaMastercard', 'amex', 'tabby', 'tamara', 'stcpay', 'urpay'],
)
.then((orderDetails) {
  /// Handle success response
})
.onError((error, stackTrace) {
  /// Handle error response
});

3. Retrieve Invoice Details: #

paylink.getInvoice(
  transactionNo: '1713690519134'
)
.then((orderDetails) {
  /// Handle success response
})
.onError((error, stackTrace) {
  /// Handle error response
});

4. Cancel Invoice: #

paylink.cancelInvoice(
  transactionNo: '1713690519134'
)
.then((_) {
  /// Handle success response
})
.onError((error, stackTrace) {
  /// Handle error response
});

By following these steps, you can easily integrate Paylink's payment gateway into your Flutter application using the paylink_payment package.

5
likes
140
pub points
40%
popularity

Publisher

verified publishersultan16.com

A Flutter Package designed to simplify the integration of Paylink's payment gateway into Flutter applications. It provides a streamlined way to handle payments within your app.

Homepage
Repository (GitHub)
View/report issues

Topics

#payment #paylink #mada #stcpay

Documentation

Documentation
API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, http, webview_flutter

More

Packages that depend on paylink_payment