flutter_paxful_pay 1.0.0-beta.2
flutter_paxful_pay: ^1.0.0-beta.2 copied to clipboard
A package for the generating PAXFul-Pay payment URLs and prompting users for payment.
flutter_paxful_pay #
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: ^1.0.0-beta.2
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 = false,
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.
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 = false,
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 = false,
fiatAmount: 70, // FIAT amount.
fiatCurrency: "USD", // FIAT currency.
);
Issues #
You might experience certain issues with the webview as it's platform view, while interacting with input fields (.e.g. alphabet keyboards showing up when you need numbers only). Some steps have been taking within this package but there are a couple things you can do to fix these issues.
1. Enable Material Components. #
The webview is in hybrid mode, and requires material components to improve the experience. Follow the guide at Enabling Material Components.
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.