TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2017 |
Maintained by Victor, MangoPay.
Open app's .plist as Source Code and add
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>mangopay.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSRequiresCertificateTransparency</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
<key>payline.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSRequiresCertificateTransparency</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
<key>yourServer.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSRequiresCertificateTransparency</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
</dict>
</dict>
Please note that if your application attempts to connect to any HTTP server (yourserver.com) that doesn't support the latest SSL technology (TLSv1.2), your connections will fail.
mangopay.framework
into your project (make sure "Copy items if needed" is selected)#import <mangopay/mangopay.h>
Important:
You should already have a webapp (the service on your server that communicates with your iOS app) and you need to add this new card registration functionality - this includes the API call to MANGOPAY (more info). You will then provide the iOS kit with the serverURL
to access this functionality (configured here). The serverURL
should return a JSON response (which has the information obtained from the MANGOPAY API) as follows:
{
"accessKey": "1X0m87dmM2LiwFgxPLBJ",
"baseURL": "https://api.sandbox.mangopay.com",
"cardPreregistrationId": "12444838",
"cardRegistrationURL": "https://homologation-webpayment.payline.com/webpayment/getToken",
"cardType": "CB_VISA_MASTERCARD",
"clientId": "sdk-unit-tests",
"preregistrationData": "ObMObfSdwRfyE4QClGtUc6um8zvFYamY_t-LNSwKAxBisfd7z3cTgS83cCwyP9Gp7qGR3aNxrLUiPbx-Z--VxQ"
}
@interface ViewController ()
@property (nonatomic, strong) MPAPIClient *mangopayClient;
@end
You can then make use of the information received from your webapp:
@property (nonatomic, strong) NSString *cardRegistrationURL;
@property (nonatomic, strong) NSString *preregistrationData;
@property (nonatomic, strong) NSString *accessKey;
@property (nonatomic, strong) NSString *clientId;
@property (nonatomic, strong) NSString *baseURL;
@property (nonatomic, strong) NSString *cardPreregistrationId;
This object is required to instantiate the MAPIClient:
self.mangopayClient = [[MPAPIClient alloc] initWithCard:cardResponseObject];
NSString* cardNumber = @"XXXXXXXXXXXXXXXX";
NSString* cardExpirationMonth = @"XX"; // ex: @"10"
NSString* cardExpirationYear = @"XX"; // ex: @"16"
NSString* cardCvx = @"XXX"; // ex: @"123"
[self.mangopayClient appendCardInfo:@"XXXXXXXXXXXXXXXX" cardExpirationDate:@"XXXX" cardCvx:@"XXX"];
[self.mangopayClient registerCard:^(NSDictionary *response, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
}
else { // card was VALIDATED
NSLog(@"VALIDATED %@", response);
}
}];