将应用板的.plist文件作为源代码打开并添加
<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>
请注意,如果您的应用程序尝试连接到任何不支持最新SSL技术(TLSv1.2)的HTTP服务器(yourserver.com),您的连接将会失败。
mangopay.framework
导入项目(确保选择了“如有必要则复制项目”)#import <mangopay/mangopay.h>
重要
您应该已经有一个web应用(与iOS应用通信的服务器上的服务)并需要添加此新的卡注册功能 - 这包括对MANGOPAY的API调用(更多信息)。然后,您将为此iOS工具包提供serverURL
以访问此功能(在此配置)。应返回以下格式的JSON响应(该响应包含从MANGOPAY API获取的信息)
{
"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
您可以使用从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;
此对象是实例化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);
}
}];