Use this guide to integrate the
hyper SDK to your Flutter app.Requirements
- Android 5.0 (API level 21) and above
- Android Gradle Plugin 8.5+
- Gradle 8.8+
- AndroidX
- iOS 13.0 and above
- CocoaPods
- npm
Installation
1. Setup the server
Follow the Server Setup section.2. Build checkout page on the client
2.1 Install the flutter_Pesaswap library
Add flutter_Pesaswap to your pubspec.yaml file:
To apply plugins using Flutter, run the following command:This command configures the necessary Flutter plugins for your project using the
flutter_Pesaswap package. Ensure you have the package installed and configured correctly in your project. If you encounter any issues, check the package documentation for more details.3. Complete the checkout on the client
3.1 Initialize the Pesaswap SDK
InitializeHyper onto your app with your publishable key using the Hyper constructor. To get a PublishableKey, please find it here.
When utilizing a custom backend or logging system, you can add the
customBackendUrl to HyperConfig.3.2 Create a Payment Intent
Make a network request to the backend endpoint you created in the previous step. TheclientSecret returned by your endpoint is used to complete the payment.
3.3 Initialize your Payment Session
Initialize a Payment Session by passing theclientSecret to the initPaymentSession:
3.4 Present payment sheet and handle response
To display the Payment Sheet, integrate a “Pay Now” button within the checkout page, which, when clicked, invokes thepresentPaymentSheet() method and handles the payment response.
Consider the below function, which invokes presentPaymentSheet and handles payment results: