IppoPay 2.0.1

IppoPay 2.0.1

Ippopay维护。



IppoPay 2.0.1

  • Ippopay

IppoPay iOS SDK集成

步骤 - 1 - 添加依赖项

pod 'IppoPay', '~> 2.0.1'
pod update

步骤 - 2 - 导入SDK

对于Swift

import IppoPay

对于Objective-C

#import "IppoPay/IppoPay-Swift.h"

步骤 - 3 - 初始化SDK

为了初始化SDK,请添加以下代码行,使用您从IppoPay商户面板中检索到的公钥。如果您没有公钥,请创建一个新的。

对于Swift

Ippopay.initSDK("Your Unique Public Key",withDelegate: Self)

对于Objective-C

[Ippopay initSDKWithPublicKey:@"Your Unique Public Key" withDelegate:self];

步骤 - 4 - 创建带有必要输入的订单数据对象

您可以使用我们的OrderData模型类创建订单数据或支付输入。在此,您需要提供订单ID和客户详细信息,如姓名、电子邮件和手机号码。

对于Swift

let orderData = OrderData()
orderData.customColor = "#12233"  // make payment page loading color as app color. 
orderData.orderId = ""  // unique order id. 
orderData.orderDescription = ""  // any description.

let customer = Customer()
customer.customerEmail = "[email protected]"
customer.customerName = "name"
customer.customerPhoneNumber = "1234567890"
orderData.customer = customer

对于Objective-C

OrderData *orderdata = [[OrderData alloc] init];
orderData.customColor = @"#12233";  // make payment page loading color as app color. 
orderData.orderId = @"";  // unique order id. 
orderData.orderDescription = @"";  // any description.

Customer *customer = [[Customer alloc] init];
customer.customerEmail = @"[email protected]";
customer.customerName = @"name";
customer.customerPhoneNumber = @"1234567890";
orderData.customer = customer;

步骤 - 5 - 使用Ippopay进行交易

使用以下代码行,使用在第4步中创建的订单数据进行支付。

Ippopay.makePayment(orderData: orderData)

对于Objective-C

[Ippopay makePaymentWithOrderData:orderdata];

步骤 - 6 - 实现支付代理

实现我们的支付代理以接收在第5步中进行的付款的付款结果。使用以下代码获取付款结果。

对于Swift

extension ViewController: IppopayDelegate{
    func onPaymentError(descriptionOfError: String) {
        // Failure Callback.
    }
    
    func onPaymentSuccess(paymentId: String) {
         // Success Callback
    }
}

对于Objective-C

@interface Main () <IppopayDelegate> {
}

- (void)onPaymentErrorWithDescriptionOfError:(NSString * _Nonnull)descriptionOfError {
    // Failure Callback.
}

- (void)onPaymentSuccessWithPaymentId:(NSString * _Nonnull)paymentId {
    // Success Callback
}

iOS 9 更新

iOS 9对安全URL的要求更高。由于许多印度银行的合规性不达标,您可以在Info.plist中实现以下代码作为替代方案。


<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

 <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>amazonToAlipay</string>
            <string>paytmmp</string>
            <string>whatsapp</string>
            <string>phonepe</string>
            <string>bhim</string>
            <string>gpay</string>
        </array>

Ippopay 日志

您可以使用以下代码行启用/禁用SDK日志。默认情况下,它将启用。

对于Swift

PayLog.setLogVisible(debug: true or false)

对于Objective-C

[PayLog setLogVisibleWithDebug:true or false];

示例付款参考。

请查看此链接了解使用以上步骤的示例付款。