flutter_paxful_pay

Build codecov pub package License: MIT

This package helps you generate PaxFul Pay URLs with parameters, and additionally opens a WebView to the generated URL for payment..

Features

  • Generate PAXFul Pay URLs with parameters, See PaxFulPay Documentation
  • Opens a WebView to the generated URL for payment

Getting started

Add the below to your pubspec.yaml file.

dependencies:
  flutter_paxful_pay: ^0.0.5

and import with

import 'package:flutter_paxful_pay/flutter_paxful_pay.dart';

Usage

To open the payment web view directly with parameters, use the following:

import 'package:flutter_paxful_pay/flutter_paxful_pay.dart';

String paymentURL = FlutterPAXFulPay.openWebView(
    context: context, // Build Context.
    apiKey: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", // Change.
    merchantId: "abc", // Change.
    to: "BTC_ADDRESS", // Change.
    secret: "secret", // Change.
    trackId: "uuid", // Unique ID for all transactions... Used for tracking on your backend...
    saveAddress = true,
    amount: 0.005, // BTC amount.
);

NB: You can prompt to pay BTC or FIAT. For BTC, the example above will suffice. For FIAT, you will need to omit the amount argument and provide the fiatAmount and fiatCurrency arguments instead. If you provided amount, fiatAmount, and fiatCurrency all together, amount will be ignored.

Your app will navigate to a new page/route with a webview as shown below.

PAXFul Pay

To generate BTC payment URLs, use the following:

import 'package:flutter_paxful_pay/flutter_paxful_pay.dart';

String paymentURL = FlutterPAXFulPay.generatePaymentURL(
    apiKey: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", // Change.
    merchantId: "abc", // Change.
    to: "BTC_ADDRESS", // Change.
    secret: "secret", // Change.
    trackId: "uuid", // Unique ID for all transactions... Used for tracking on your backend...
    saveAddress = true,
    amount: 0.005, // BTC amount. Min is 0.0004 from PaxFul.
);

To Generate FIAT payment URLs, use the following:

import 'package:flutter_paxful_pay/flutter_paxful_pay.dart';

String paymentURL = FlutterPAXFulPay.generatePaymentURL(
    apiKey: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", // Change.
    merchantId: "abc", // Change.
    to: "BTC_ADDRESS", // Change.
    secret: "secret", // Change.
    trackId: "uuid", // Unique ID for all transactions... Used for tracking on your backend...
    saveAddress = true,
    fiatAmount: 70, // FIAT amount.
    fiatCurrency: "USD", // FIAT currency.
);

Additional information

For a practical example, see the package example section.

Contributing

Pull requests are welcome.

Send pull requests to the develop branch.

For major changes, please open an issue first to discuss what you would like to change.