This is a sample project to show how to use the slydepay sdk to accept mobile money from several networks and credit card payments in your android apps.
Payment Options | Mobile Money | Visa | Success | Error |
---|---|---|---|---|
Create a Merchant Account on Slydepay
Follow the link to get started on that: (Slydepay Merchant Account)
To use the sdk in your project:
- Download the project zip file.
- Unzip the file.
- In android studio right file -> new - import module and go to the path for the zip file -> open the folder -> and click on paywithslydepay.
- Change the name of your module if you wish and click next.
- Wait till the build finishes and you now have the paywithslydepay sdk.
From Android Studio :
->Right click your project folder
->Open Module Settings
->Select the Dependency Tab
->Tap on the green plus sign on the right and select "Module dependency"
->You would see the "paywithslydepay" module. Select it.
Tap on OK and you are good to add it in your build.gradle file.
- Initialize sdk preferably in your Application class to avoid initializing it multiple time. How to create an Application class
//merchantEmail and merchantKey refers to the credentials associated with your merchant account from SLYDEPAY
new SlydepayPayment(YourActivity.this).initCredentials.initCredentials(merchantEmail,merchantKey);
- Performing transactions.
//Performing transaction with provided ui
PayWithSlydepay.Pay("itemName",amount,"description","customerName","customerEmail","orderCode","phoneNumber",requestCode);
//Listen for results
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==YOUR_REQUEST_CODE)
{
switch (resultCode){
case RESULT_OK:
//Payment was successful
break;
case RESULT_CANCELED:
//Payment failed
break;
case RESULT_FIRST_USER:
//Payment was cancelled by user
break;
}
}
}
You can now recieve payments through your app with Slydepay
@Knesis For his sdk Slydepay-android-sdk-with-sample
- Write tests.
- Singleton approach.