TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2016 |
Maintained by Anton Domashnev, Anton Domashnev.
This contains the Payleven InApp-SDK-iOS Framework to be linked as a CocoaPod.
The reason for making this repo was that the Payleven InApp-SDK-iOS framework is not available to integrate it via CocoaPods
. And the only option is to integrate it via vendored_frameworks
as a dependency to other Podspec
. But unfortunately this leads to another problem related to CocoaPods
- and it mentioned in that issue. Now the framework can be integrated as a dependency
in the Podspec
Use the unique API key to authenticate your app
[[PLVInAppClient sharedInstance] registerWithAPIKey:@”anAPIKey”];
Create an object of PLVCreditCardPaymentInstrument
class.
If it's the first time you are trying to add a payment instrument for your user, you need to create a user token, based on the user's email address.
PLVCreditCardPaymentInstrument * tempCC = [PLVCreditCardPaymentInstrument createCreditCardPaymentInstrumentWithPan:@"12345678901234"
expiryMonth:@"11"
expiryYear:@"2020"
cvv:@"111"
andCardHolder:@"Payleven Cardholder"];
//Create User Token
[[PLVInAppClient sharedInstance] createUserToken:@"[email protected]"
withPaymentInstrument:tempCC
useCase:@"Business"
andCompletion:^(NSString *userToken, NSError *error){
if (userToken) {
//Success, this token should now be forwarded to your Backend...
} else {
//Error handling
}
}];
//Or simply add Payment Instrument to existing User Token
[[PLVInAppClient sharedInstance] addPaymentInstrument:tempCC
forUserToken:<Pass User Token you received from createUserToken:>
withUseCase:@"Business"
andCompletion:^(NSError* error) {
if (error) {
//Error handling
} else {
//Success
}
}];
Use the user token to retrieve the payment instruments associated to it and to a specific use case.
The list of payment instruments is sorted based on the order in which the payment instruments will be selected when making a payment.
Note: Before offering your business services, call getPaymentInstrumentsList
to make sure that the user has at least one valid (not expired) payment instrument.
[[PLVInAppClient sharedInstance] getPaymentInstrumentsList:@"A User Token"
withUseCase:@"A Use Case" andCompletion:^(NSArray *paymentInstrumentsArray, NSError *error){
if(paymentInstrumentsArray){
self.piArray = piListArray;
} else {
//Error handling
}
}];
To update the order in which the payment instruments will be used when making a payment, call setPaymentInstrumentsOrder
with the ordered list of payment instruments, the user token and the use case to which they belong.
Check out PayInstTableViewController's tableView:moveRowAtIndexPath: in our sample app for a complete implementation.
NSOrderedSet* ordedSet = [[NSOrderedSet alloc] initWithArray:self.piArray];
[[PLVInAppClient sharedInstance] setPaymentInstrumentsOrder:ordedSet
forUserToken:self.userToken
andCompletion:^(NSError *error) {
if (error) {
//Error handling
} else {
//Success
}
}];
Remove a payment instrument, belonging to a specific user token, from a use case. After this, the payment instrument cannot be used to make payments for that use case.
[[PLVInAppClient sharedInstance] removePaymentInstrument:pi
fromUseCase:@"A Use Case"
forUserToken:@"A User Token" andCompletion:^(NSError* error){
if (error) {
//Error handling
} else {
//Success
}
}];
Disable a payment instrument, belonging to a specific user token. The payment instrument will be removed from all use cases.
[[PLVInAppClient sharedInstance] disablePaymentInstrument:pi forUserToken:@"A User Token" andCompletion:^(NSError* error){
if (error) {
//Error occured, see error.localizedDescription
} else {
//Success
}
}];
According to original repo it's MIT