GitHub 저장소abom-me/thawani_payment

thawani_payment

Flutter 패키지로 Flutter 앱에 Thawani 결제 기능을 추가할 수 있습니다

thawani_payment 프로젝트 이미지
스타
6
포크
1
최근 푸시(UTC)
2025. 2. 10.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

thawani_payment:


A package helps you to use thawani checkout api , to add thawani payment in Flutter App

# 👨‍💻 Developed by:

profile

Nasr Al-Rahbi @abom_me

👨🏻‍💻 Find me in :

Twitter Instagram LinkedIn Stack Overflow



thawani_payment using the official webview_flutter.

⚠️ The Requirement ⚠️ :
Android iOS
Support SDK 19+ or 20+ iOS 9+

Setup:

Pubspec changes:

      dependencies:
        thawani_payment: <last_verison>

Sample example to add pay button :

import 'package:thawani_payment/thawani_payment.dart';

ThawaniPayBtn(
  api: 'API Key',
          pKey: 'Publishable Key',
          clintID: 'String',
          onError: (e){},
          products:[],
          onCreate: (v) {},
          onCancelled: (v){},
          onPaid: (v){}, 
          );

Sample example to add pay function :

import 'package:thawani_payment/thawani_payment.dart';

Thawani.pay(
  api: 'API Key',
          pKey: 'Publishable Key',
          clintID: 'String',
          onError: (e){},
          products:[],
          onCreate: (v) {},
          onCancelled: (v){},
          onPaid: (v){}, 
          );

Getting Started

Android
  1. You should however make sure to set the correct minSdkVersion in android/app/build.gradle if it was previously lower than 19:
android {
    defaultConfig {
        minSdkVersion 19
    }
}
Note
  • This package will update if there any update in Thawani checkout
  • Your use of the package is your personal choice. The developer of the package has nothing to do with errors that may occur with you during payment.
  • I recommend using the test mode to ensure that the package is free of errors before uploading it to users.

See the example directory for a complete sample app.

Parameters of the ThawaniPayBtn

  ///  API Code From Thawani Company
  ///  For Test Mode: rRQ26GcsZzoEhbrP2HZvLYDbn9C9et
  
  final String api;

/// The Publishable Key From Thawani Company
/// For Test Mode: HGvTMLDssJghr9tlN9gr4DVYt0qyBy
  
  final String pKey;
  
  /// The Widget  Shown In The Button , By Default it have Text
  /// Text("Pay",style: TextStyle(color: Colors.white,fontSize: 17),)
 
  final Widget? child;
  
  
  /// Button Style
  /// ButtonStyle(
  ///     elevation: MaterialStateProperty.all(0),
  ///     shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
  ///    backgroundColor: MaterialStateProperty.all(const Color(0xff4FB76C)),
  ///   )
  
  final ButtonStyle? buttonStyle;

 
  /// The Clint Id to be generated by merchant to identify the session (From Thawani API Doc).
  /// You can use The User ID As Clint ID
  
  final String clintID;

 
  /// The customer would be redirected to successUrl if payment processed successfully (From Thawani API Doc).
  /// In This Package , The URL Unuseful
  
  final String?  successUrl;
 
 
  /// The customer would be redirected to successUrl if he decides to cancel the payment (From Thawani API Doc).
  /// In This Package , The URL Unuseful
 
  final String? cancelUrl;

  
  /// A list of products the customer is purchasing. maximum  100 products (From Thawani API Doc).
  /// [
  ///      {
  ///        "name": "product Name",
  ///         "unit_amount": the price by Baisa, >=100 <=5000000000
  ///        "quantity": the quantity of the line product,  >=1 <=100
  ///       }
  ///     ]
  
  final List<Map> products;

  
  /// Useful for storing additional information about your products, customers (From Thawani API Doc).
  /// storing Any Data about your products, customers(users)
  /// EX:
  /// { "userName":"Nasr Al-Rahbi", "Twitter":"abom_me"}
 
  final Map? metadata;

 
  /// Make It true If You Want Test The Package Or The Api
  /// By Default It's false
  /// testMode: false
  
  final bool? testMode;

  
  ///The Function And The Result Of Data After Create Session.
  
  final void Function(Create create) onCreate;

  ///The Function And The Result Of Data If The User  Cancelled The Payment.
 
  final void Function(StatusClass payStatus) onCancelled;

  ///The Function And The Result Of Data If The User  Cancelled The Payment.
 
  final void Function(StatusClass payStatus) onPaid;

  ///The Function And The Reason Of The Error,  If Any Error Happen.
  
  final  Function(Map error)? onError;

Real Example:

Photo Example

🤗 Special thanks :

  • For Khalfan @pwkhalfan , for helping me with Thawani Document
Nasr Al-Rahbi GitHub avatar
GitHub 작성자

Nasr Al-Rahbi ↗

Full-Stack Developer- Flutter, Firebase,PHP And Mysql

Oman
언어DartHTMLRubySwiftKotlinObjective-C

분류

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 7 개

  • http^1.1.0
  • webview_flutter^4.3.0
  • webview_flutter_android^3.12.0
  • webview_flutter_wkwebview^3.9.0
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^2.0.0

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗