moneyhash_payment
About MoneyHash
MoneyHash is a Super-API infrastructure for payment orchestration and revenue operations in emerging markets. We provide a single integration to your network of pay-in and pay-out providers, and various other services that you can utilize and combine to build a unique custom payment stack. Our core features include:
- A single API/SDK integration for Pay-in & Pay-out
- Unified checkout embed compatible with all integrated providers
- Orchestration and routing capabilities to allow for optimal transaction route and to increase authorization rates
- Micro-services to extend your stack capabilities such as subscription management, invoicing, and payment links
- PCI-compliant card vault to store and tokenize sensitive customer and card information
- Central dashboard for a unified stack controls and transaction reporting
You can learn more about us by visiting our website.
MoneyHash Flutter Support
The SDK allows you to build full payment experiences in your native Android and iOS apps using Flutter.
Installation
dart pub add moneyhash_payment
Requirements
Android
- Compatible with apps targeting Android 5.0 (API level 21) and above
- Use Kotlin version 1.6.10 and above: example
- Using an up-to-date Android Gradle Plugin
- AndroidX (as of v11.0.0)
Enable viewBinding
in your project.
buildFeatures {
viewBinding true
}
iOS
Compatible with apps targeting iOS 11 or above.
Create a Payment Intent
You will need to create a Payment Intent and use it's ID to initiate the SDK, There are two ways to create a Payment Intent:
-
Using The Sandbox
Which is helpful to manually and quickly create a Payment Intent without having to running any backend code. For more information about the Sandbox refer to this section
-
Using The Payment Intent API
This will be the way your backend server will eventually use to create a Payment Intents, for more information refer to this section
Usage Example
To start the payment flow use the Payment Intent ID from the step above as a parameter along with a PaymentResultContract instance like below:
1- Add PaymentActivity to AndroidManifest.xml
<activity android:name="com.moneyhash.sdk.android.payment.PaymentActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/>
2-
startPaymentFlow
import 'package:moneyhash_payment/moneyhash_payment.dart';
MoneyHashPaymentResult? result;
try {
result = await MoneyhashPayment.startPaymentFlow("YourPaymentIntentIdHere");
} on PlatformException {
// Handle the errors
}
startPayoutFlow
1- Add PaymentActivity to AndroidManifest.xml
<activity android:name="com.moneyhash.sdk.android.payout.PayoutActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/>
2-
import 'package:moneyhash_payment/moneyhash_payment.dart';
MoneyHashPayoutResult? result;
try {
result = await MoneyhashPayment.startPayoutFlow("YourPayoutIntentIdHere");
} on PlatformException {
// Handle the errors
}
Payment Statuses
Once your customer finishes adding the payment information they will reach one of the following statuses, and a callback is fired with the payment status which indicate the current status of your payment.
Status | # |
---|---|
Error | There was an error while processing the payment and more details about the errors will be found inside errors data. |
Success | The payment is Successful. |
RequireExtraAction | That payment flow is done and the customer needs to do some extra actions off the system, a list of the actions required by the customer will be found inside the actions data, and it should be rendered to the customer in your app. |
Failed | There was an error while processing the payment. |
Unknown | There was an unknown state received and this should be checked from your MoneyHash dashboard. |
Cancelled | The customer cancelled the payment flow by clicking back or cancel. |
Redirect | That payment flow is done and the customer needs to be redirect to redirectUrl . |
MoneyHashPaymentResult
class MoneyHashPaymentResult {
final String status; // Payment Status
final String? errors; // errors if any (incase of status = "error")
final String? extraActions; // list of extra actions required (incase of status = "require_extra_action")
final String? redirectUrl; // link needs to be redirect to (in case of status = "redirect")
final PaymentResult? result; // the payment details (in case of status = "success" || status = "redirect" ||status = "require_extra_action" || status = "failed")
}
class PaymentResult {
final PaymentIntent? intent;
final PaymentTransaction? transaction;
}
MoneyHashPayoutResult
class MoneyHashPayoutResult {
final String status; // Payout Status
final String? errors; // errors if any (in case of status = "error")
final String? extraActions; // list of extra actions required (in case of status = "require_extra_action")
final String? redirectUrl; // link needs to be redirect to (in case of status = "redirect")
final PayoutResult? result; // the payout details (in case of status = "success" || status = "redirect" || status = "require_extra_action" || status = "failed")
}
class PayoutResult {
final PayoutIntent? intent;
final PayoutTransaction? transaction;
}
Questions and Issues
Please provide any feedback via a GitHub Issue.