All Projects → ayyshim → esewa_pnp

ayyshim / esewa_pnp

Licence: MIT License
Unofficial esewa plugin for flutter application.

Programming Languages

objective c
16641 projects - #2 most used programming language
dart
5743 projects
java
68154 projects - #9 most used programming language
swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to esewa pnp

rawtx
A Golang module that helps you answer questions about raw Bitcoin transactions, their inputs, outputs and scripts.
Stars: ✭ 12 (-68.42%)
Mutual labels:  transaction
k2hash
K2HASH - NoSQL Key Value Store(KVS) library
Stars: ✭ 33 (-13.16%)
Mutual labels:  transaction
tokensubscription.com
⏰💰🤠 Set-it-and-forget-it token subscriptions on the Ethereum mainnet. #Winner #WyoHackathon
Stars: ✭ 81 (+113.16%)
Mutual labels:  transaction
numerifides
A proposal for a system of decentralized trust, built on an open, public blockchain.
Stars: ✭ 14 (-63.16%)
Mutual labels:  transaction
nepali date picker
Material Style Date Picker with Bikram Sambat(Nepali) Calendar Support. Supports both Android and ios.
Stars: ✭ 30 (-21.05%)
Mutual labels:  nepal
openmessaging.github.io
OpenMessaging homepage
Stars: ✭ 12 (-68.42%)
Mutual labels:  transaction
factomjs
Javascript library to build applications on the Factom blockchain.
Stars: ✭ 23 (-39.47%)
Mutual labels:  transaction
pimux
Access Termux-api through python
Stars: ✭ 23 (-39.47%)
Mutual labels:  nepal
dtm
A distributed transaction framework that supports multiple languages, supports saga, tcc, xa, 2-phase message, outbox patterns.
Stars: ✭ 6,110 (+15978.95%)
Mutual labels:  transaction
nepali-datetime
Python's core datetime inspired nepali datetime (BS date & NPT) package 🇳🇵
Stars: ✭ 36 (-5.26%)
Mutual labels:  nepal
k2hftfuse
File transaction by FUSE-based file system
Stars: ✭ 30 (-21.05%)
Mutual labels:  transaction
Tour360
Tour360 is a virtual reality viewing platform that helps to view 360 degree images, book flights, hotels and guides.
Stars: ✭ 14 (-63.16%)
Mutual labels:  nepal
ethereum-tx
Ethereum transaction library in PHP.
Stars: ✭ 144 (+278.95%)
Mutual labels:  transaction
indyscan
Hyperldger Indy Transaction Explorer
Stars: ✭ 52 (+36.84%)
Mutual labels:  transaction
transaction-rs
The transaction abstraction library and its executors for rust
Stars: ✭ 16 (-57.89%)
Mutual labels:  transaction
sesdashboard
Analytics and activity tracking dashboard for AWS Simple Email Service
Stars: ✭ 36 (-5.26%)
Mutual labels:  transaction
altcoin-bitcoin-explorer
PHP Altcoin/Bitcoin Data Explorer
Stars: ✭ 19 (-50%)
Mutual labels:  transaction
ETH-transactions-storage
Indexer for Ethereum to get transaction list by ETH address
Stars: ✭ 155 (+307.89%)
Mutual labels:  transaction
nepali-datasources
A list of data sources for Nepal related data.
Stars: ✭ 23 (-39.47%)
Mutual labels:  nepal
neo4j-php-client
Php client and driver for neo4j database
Stars: ✭ 95 (+150%)
Mutual labels:  transaction

esewa_pnp

All Contributors

Starware pub package

esewa_pnp is flutter plugin that let's developer to integrate native eSewa payment method into their flutter application with just few lines of code.

How to install

  • Depend on it

    dependencies:
    	esewa_pnp: ^1.0.7
  • [Android] Add following attribute inside your AndroidMainfest.xml

     <application
        ...
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        ...>
    ...
    </application>
    
  • [iOS] esewa_pnp (version ^1.0.0) iOS can not be tested on simulator. For that you will need to depend on plugin from plugin's GitHub repository "dev" branch.

    dependencies:
    	# esewa_pnp: ^1.0.7 # Use it on production app or while testing esewa_pnp on real physical iOS device.
    	esewa_pnp:
    		git:
    			url: git://github.com/ayyshim/esewa_pnp.git
    			ref: dev

Usage

  1. Create a ESewaConfiguration object. Start with test environment. When application is ready, you can switch it to live (ENVIRONMENT_LIVE)
...

ESewaConfiguration _configuration = ESewaConfiguration(
    clientID: "<Client-ID>",
    secretKey: "<Secret-Key>",
    environment: ESewaConfiguration.ENVIRONMENT_TEST //ENVIRONMENT_LIVE
);
...

clientID and secretKey values are provided by eSewa to its merchant/client and is unique for each. For development phase, you can use the following credentials:

clientID: "JB0BBQ4aD0UqIThFJwAKBgAXEUkEGQUBBAwdOgABHD4DChwUAB0R"

secretKey: "BhwIWQQADhIYSxILExMcAgFXFhcOBwAKBgAXEQ=="

  1. Create ESewaPnp object and pass configuration.
...
ESewaPnp _eSewaPnp = ESewaPnp(configuration: _configuration);
  1. Finally create the payment object
...
ESewaPayment _payment = ESewaPayment(
    amount: <ANY_DOUBLE_VALUE>,
    productName: "<Product-Name>",
    productID: "<Unique-Product-ID>",
    callBackURL: "<Call-Back-URL>"
);
...
  1. Now call initPayment method.
...
final _res = await _eSewaPnp.initPayment(payment: _payment);
...
  1. Determine application behavior according to the response. Wrap the .initPayment method inside try-catch block.
...
try {
	final _res = await _eSewaPnp.initPayment(payment: _payment);
	// Handle success
} on ESewaPaymentException catch(e) {
	// Handle error
}
...

ESewaPaymentException

ESewaPaymentException class is thrown when payment process fails.

  • .message [String] : returns the error message

ESewaResult

ESewaResult is returned when payment process successful.

  • .message [String] : returns readable success message
  • .productId [String] : returns product id of the product customer paid for
  • .productName [String] : returns product name of the product customer paid for
  • .totalAmount [String] : returns total amount customer paid
  • .date [String] : returns the date of transaction
  • .status [String] : returns the transaction status
  • .referenceId [String] : returns the transaction reference id

🆕 ESewaPaymentButton

ESewaPaymentButton is a customizable button widget. It takes ESewaPnp, 6 required named parameters and 8 optional parameters.

To use this button you must download assets and paste it inside your assets folder of your project. Add following line inside your pubspec.yaml file too.

  ...
  flutter:
    assets:
      - assets/esewa/
  ...

Example #1 (Default):

  ...
  ESewaPaymentButton(
    _esewaPnp,
    amount: 800.0,
    callBackURL: "https://example.com",
    productId: "abc123",
    productName: "ESewa Pnp Example",
    onSuccess: (ESewaResult result) {
      // Do something with Result
    },
    onFailure: (ESewaPaymentException e) {
      // Do something with Error
    },
  ),
  ...

Example #2 (White background):

Changing button color will also result to dyanmically change in label color and esewa logo varient (dark/light).

  ...
  ESewaPaymentButton(
    _esewaPnp,
    amount: 800.0,
    callBackURL: "https://example.com",
    productId: "abc123",
    productName: "ESewa Pnp Example",
    onSuccess: (ESewaResult result) {
      // Do something with Result
    },
    onFailure: (ESewaPaymentException e) {
      // Do something with Error
    },
    color: Color(0xFFFFFFF), // White background
  ),
  ..

Example #3 (with labelBuilder):

  ...
  ESewaPaymentButton(
    _esewaPnp,
    amount: 800.0,
    callBackURL: "https://example.com",
    productId: "abc123",
    productName: "ESewa Pnp Example",
    onSuccess: (ESewaResult result) {
      // Do something with Result
    },
    onFailure: (ESewaPaymentException e) {
      // Do something with Error
    },
    color: Color(0xFF60BB47), // Green background
    labelBuilder: (int amount, Widget esewaLogo) {
      return Text("Pay Rs.$amount");
    }
  ),
  ..

Output: Screenshot

Platform Support

Platform Status
Android
iOS

👨‍🦱 Author

Ashim Upadhaya

Checkout example implementation : EsewaPnp Example

🌟 Starware

esewa_pnp is Starware.
This means you're free to use the project, as long as you star its GitHub repository.

Contributors

Thanks goes to these wonderful people (emoji key):


Aawaz Gyawali

💻

Bibek Timsina

💻

Pratibimba Khadka

💻

Aarjan Baskota

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].