Documentation
MINT iOS SDK
Do you need a simple and safe method to receive in-app payments? MINT is Paymentwall's cash payment solution designed to help monetize your digital goods and services all over the world.
Our MINT iOS SDK delivers a way to minimize development time and help accept MINT ePins in your application in several simple steps. Follow our instructions and start accepting MINT today!
How does it work?
The customer clicks on the “Buy” button inside your application. The MINT SDK is called at this moment and displays a pop up dialog with the payment information and field for entering the ePin. User enters ePin into the field and taps on the “Buy” button. The payment is completed and your callback function is triggered to handle its result. Your backend will be also notified about it.
Requirements
Credentials
Your mobile integration requires a Project key.
You can obtain these Paymentwall API credentials in the application settings of your Merchant Account at Paymentwall.com
Add SDK to your project
- In the menubar click "File" then "Add file to YOUR_PROJECT".
- Select the "MintSDK" directory in the downloaded repository.
- Make sure 'Copy items into destination group's folder (if needed)' is checked.
- Click "Add"
- Click on your project, in Targets tab click in "Build Settings"
- In the "Header Search Paths" add link to include file of SDK such as "$SOURCE_ROOT/MintSDK/include"
- In the "Library Search Paths" add link to file "MintSDK.a"
- In "Build Phases" tab add "MintResources.bundle" to "Copy Bundle Resources"
Accepting your first payment
Add the following imports
Objective-C
import "MintSDK.h"
Swift
Add this command to your Bridging-Header.h file
import "MintSDK.h"
Create MINT request
Objective-C
[MintSDK createNewPaymentWithApplicationID:YOUR_APPLICATION_HERE
userID:YOUR_USER_ID
paymentName:PAYMENT_NAME
paymentAmount:PAYMENT_AMOUNT
paymentCurrency:PAYMENT_CURRENCY];
Swift
MintSDK.createNewPaymentWithApplicationID(YOUR_APPLICATION_HERE,
userID:YOUR_USER_ID,
paymentName:PAYMENT_NAME,
paymentAmount:PAYMENT_AMOUNT,
paymentCurrency:PAYMENT_CURRENCY)
Start MINT dialog
Objective-C
[MintSDK createNewPaymentWithApplicationID:YOUR_APPLICATION_HERE userID:YOUR_USER_ID paymentName:PAYMENT_NAME paymentAmount:PAYMENT_AMOUNT paymentCurrency:PAYMENT_CURRENCY];
//Create Mint Payment Dialog
MintViewController *viewcontroller = [MintSDK createNewMintViewController];
viewcontroller.delegate = self;
[viewcontroller showMintWithParentViewController:self completion:^(int code){
}];
Swift
MintSDK.createNewPaymentWithApplicationID(YOUR_APPLICATION_HERE, userID: YOUR_USER_ID, paymentName:PAYMENT_NAME, paymentAmount:PAYMENT_AMOUNT, paymentCurrency:PAYMENT_CURRENCY)
//Create Mint Dialog
var viewController: MintViewController = MintSDK.createNewMintViewController()
viewController.delegate = self
viewController.showMintWithParentViewController(self, completion:{ (code) -> Void in
})
Result handling
You have to add MintSDKDelegate to your ViewController:
Objective-C
@interface YourViewController : UIViewController <MintSDKDelegate>
Swift
class YourViewController: UIViewController, MintSDKDelegate
You can handle payment results by defining your callback function. We recommend syncing up with your server at this stage to sync up user's balance, confirm purchased item etc. See the example:
Objective-C
#pragma mark - Mint SDK Delegate
-(void)mintResponse:(MintResponse *)response
{
switch (response.responseCode) {
case MINT_SUCCESSFUL:
//Do something here
break;
case MINT_FAILED:
//Do something here
break;
case MINT_CANCEL:
//Do something here
break;
default:
break;
}
}
Swift
// MARK:- Mint SDK Delegate
func mintResponse(response: Mint Response!) {
switch response.responseCode {
case Int32(MINT_SUCCESSFUL.value):
//Do something here
break
case Int32(MINT_FAILED.value):
//Do something here
break
case Int32(MINT_CANCEL.value):
//Do something here
break
default:
break
}
}
ResultCode code can get one of the following values:
MINT_SUCCESSFUL
: the user has completed the payment.
MINT_FAILED
: the user cannot complete the payment (he has entered at least one ePin but it was rejected by our system)
MINT_CANCEL
: the user has aborted the payment.
Server notification handling
After each successful payment we will notify your server about it. We recommend to use this feature as it is the most reliable way to know when the payment went through. Even if your application crashes for some reason, your server will still be notified, so you can sync up later. Please use pingback processing documentation pingback processing documentation for more information.