搜尋套件、儲存庫與 APP 分類

套件詳情v1.2.0

midtrans_sdk

Midtrans 移動 SDK 的 Flutter 插件。支援 iOS 和 Android。

AndroidiOS
近 30 天下載
102
喜歡數
26
Pub 分數
140

安裝套件

flutter pub add midtrans_sdk

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

midtrans_sdk 是一個 Flutter 插件,可將 Midtrans 移動 SDK 集成到 Android 和 iOS 應用程式中,實現無縫的內應用支付處理。它提供了一個簡單的介面,用於啟動支付、處理交易回調以及安全地管理支付流程。專為希望在其 Flutter 應用中加入可靠支付功能的開發者設計,支援 Midtrans 提供的各種支付方式,包括信用卡、電子錢包和銀行轉帳。該插件確保與兩大主要行動平台相容,並簡化了與 Midtrans 後端服務的整合。

適用情境

  • 應用內購買
  • 電子商務結帳
  • 行動錢包整合
  • 訂閱計費
  • 數位服務付款

主要特色

  • 支援 Android 與 iOS
  • 安全支付處理
  • 交易回呼處理
  • 與 Midtrans 的輕鬆整合
  • 即時支付狀態更新

適合對象

  • Flutter 開發人員建構電商應用
  • 需要多種支付方式的應用程式
  • 使用 Midtrans 作為支付網關的開發者
  • 需要快速支付整合的初創企業
  • 面向東南亞市場的行動應用程式

使用建議

  • 需要一個 Midtrans 帳戶
  • 需要正確的 API 金鑰設定
  • 依賴原生 SDK 以實現完整功能
  • 沙盒測試可能需要額外的設定
  • 僅限Midtrans支援的地區

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

midtrans_sdk

A Flutter plugin for Midtrans Mobile SDK. Visit https://midtrans.com.

pub package


Supported Platforms

  • [x] Android
  • [x] iOS
  • [ ] Web

Usage

To use this plugin, add midtrans_sdk as a dependency in your pubspec.yaml file.

Getting started

See the example directory for a sample about start payment by using snap token which using midtrans_sdk.

Android
  • If you are using FlutterActivity directly, change it to FlutterFragmentActivity in your AndroidManifest.xml.
  • If you are using a custom activity, update your MainActivity.java:
import io.flutter.embedding.android.FlutterFragmentActivity;

public class MainActivity extends FlutterFragmentActivity {
    // ...
}

or MainActivity.kt:

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity() {
    // ...
}

MidtransConfig

To start using Midtrans you first need to create an instance of MidtransSDK before using any other of our sdk functionalities.
MidtransSDK receives a MidtransConfig object. This is how you can configure our MidtransSDK instance and connect it to your Midtrans account.

Example:

import 'package:midtrans_sdk/midtrans_sdk.dart';

var config = MidtransConfig(
  clientKey: "",
  merchantBaseUrl: "",
  colorTheme: ColorTheme(
    colorPrimary: Theme.of(context).colorScheme.primary,
    colorPrimaryDark: Theme.of(context).colorScheme.primary,
    colorSecondary: Theme.of(context).colorScheme.secondary,
  ),
);

Initializing the SDK

The next step is to call init which have the required MidtransConfig object parameter config. After we call init we can use all of Midtrans SDK features. Initialize the SDK to enable Midtrans to start payment.

MidtransSDK.init(
    config: config,
);

Starting payment

Start payment method screen

Default mode for midtrans_sdk is showing payment method screen. This screen will show all of your available payment methods. You can enable/disable payment methods via Snap Preferences in MAP.

Start payment by using snap token

We provide SDK method to allow you to make payment by using snap token without initialize transaction request first. You just need to pass snap token as argument of startPaymentUiFlow method.

_midtrans?.startPaymentUiFlow(
    token: "snap-token",
);

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。