preface

It is quite busy these days, and the products of major companies need to reconstruct and add a currency payment system. When it comes to payments on mobile devices, it’s natural to think about payments. The mainstream of payment is wechat, Alipay and UnionPay. Developers who have done these SDK integrations know that integration is relatively complex and that it takes a lot of time to read the development documentation they provide, but thankfully there are many developers sharing their integration tips to make it easier, such as: IOS payment [alipay, unionpay, wechat], 10 minutes to fix all kinds of alipay and wechat pay pit filling and so on, but, in fact, there is more simple,Ping++.

What does Ping++ do?

Ping++ is a next-generation payment system tailored for mobile applications and PC web pages. Through an SDK, it can support multiple mainstream payment channels of mobile and PC web pages at the same time. You only need one access to complete the access of multiple channels. Ping++ SDK includes two parts: Client SDK and Server SDK. It supports seven mainstream back-end development languages and ADAPTS Android, iOS and HTML5 mobile platforms as well as PC web pages. Ps: Official words.

Talk about my understanding: I think the most convenient is that there is no need to fill in a variety of appkeys on the mobile terminal, a variety of secret keys, such as alipay payment has a secret key is particularly troublesome, these tedious things Ping++ do for you, you just need to save the key application down in the configuration information system of Ping++. I have to apply for some permissions, but these operations are my boss, but it is very convenient. There is also a single line of code that can activate various payments. This feels very refreshing to me as I have done various native payment SDKS. Post the code and feel it:

 [Pingpp createPayment:charge
                   viewController:weakSelf
                     appURLScheme:kUrlScheme
                   withCompletion:^(NSString *result, PingppError *error) {
                     NSLog(@"completion block: %@", result);
                     if (error == nil) {
                       NSLog(@"PingppError is nil");
                     } else {
                       NSLog(@"PingppError: code=%lu msg=%@",
                             (unsigned long)error.code, [error getMsg]);
                     }
                     [weakSelf showAlertMessage:result];
                   }];
Copy the code

Usage:

1, Use CocoaPods to add to your Podfile:

pod 'Pingpp'.'~ > 2.2.6'
Copy the code

2. Manually download the iOS SDK to the local directory, including lib and example. Under the example directory is the sample project. You need to add files from the lib directory to your project. For details, see the Ping++ iOS SDK access guide.

Tell me about the pit I encountered:

Ping++ Channels is a channel that displays Mmdpay. That’s a bit of an exaggeration

One more thing: To get the result callback right, call Pingpp handleOpenURL:url withCompletion:nil in the project AppDelegate file. If the second argument to the method passes nil, process the result of the callback in Completion in the createPayment method. Otherwise, process the results here. If you use wechat sharing, login, etc., which seems to “conflict” here, you can first determine which method to call by checking the URL’s host. You can also call the Ping++ method first. If return is false, the url is not pay-related, and then you can call the module’s method. Post my code for solving this problem:

- (BOOL) Application (UIApplication *) Application openURL (NSURL *) URLsourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    BOOL isPay = [Pingpp handleOpenURL:url withCompletion:nil];
    if(isPay){
        return isPay;
    }else{
        return[UMSocialSnsService handleOpenURL:url wxApiDelegate:nil]; }}Copy the code

It’s worth noting here, [Pingpp createPayment:(NSObject *) appURLScheme:<#(NSString *)#> WithCompletion :<#^(NSString *result, PingppError *error) Completion# >] That’s about it, more payment features are likely to be added in the future, and I’ll keep updating this post if I get stuck.

Refer to the article

IOS SDK access guide iOS app “Ping++” payment integration Ping++ SDK, introduced iOS configuration instructions