简体   繁体   English

如何在不要求用户登录ios的情况下集成Citrus支付网关?

[英]How to integrate Citrus payment gateway without asking for login to user in ios?

Hope you are doing well. 希望你一切顺利。

I am trying to integrate CitrusPay SDK to my iPhone application. 我正在尝试将CitrusPay SDK集成到我的iPhone应用程序中。 How can i integrate CitrusPay Direct payment without asking user to login to citrus pay. 我如何集成CitrusPay Direct付款而不要求用户登录citrus pay。

I want to give options to user like : 我想给用户这样的选项:

  1. Pay using Citrus Wallet 使用柑橘钱包付款
  2. Pay using Creditcard/Debit Card 使用信用卡/借记卡付款
  3. Pay using Net banking 使用网上银行付款

If user would like to pay using Citrus Wallet then i will ask user to login to citrus using their credentials. 如果用户想使用Citrus Wallet付款,那么我将要求用户使用其凭据登录到柑橘。 If they will go with 2nd or 3rd option like pay using Credit Card/Debit Card or net banking then they don't need to login. 如果他们选择使用信用卡/借记卡或网上银行付款的第二或第三选项,则无需登录。

I want to implement this function in my app using CitrusPay SDK. 我想使用CitrusPay SDK在我的应用程序中实现此功能。 Can you point out me for the code of this? 您能指出我的代码吗?

I already have a demo of the Citrus pay and i already checked it. 我已经有一个柑橘工资的演示,并且我已经检查了。

https://github.com/citruspay/citruspay-ios-sdk https://github.com/citruspay/citruspay-ios-sdk

I downloaded the demo from the above link. 我从上面的链接下载了演示。

Please help me out for this. 请帮我解决这个问题。

    [CitrusPaymentSDK enableDEBUGLogs];

    CTSKeyStore *keyStore = [[CTSKeyStore alloc] init];
    keyStore.signinId = SignInId;
    keyStore.signinSecret = SignInSecretKey;
    keyStore.signUpId = SubscriptionId;
    keyStore.signUpSecret = SubscriptionSecretKey;
    keyStore.vanity = VanityUrl;

    [CitrusPaymentSDK initializeWithKeyStore:keyStore environment:CTSEnvSandbox];

    [CitrusPaymentSDK enableDEBUGLogs];

    //CC, DC payments
    CTSElectronicCardUpdate *creditCard = [[CTSElectronicCardUpdate alloc] initCreditCard]; //for debit card use > initDebitCard
    creditCard.number = @"";
    creditCard.expiryDate = @"XX/XX"; //only mm/yyyy format
    creditCard.scheme = [CTSUtility fetchCardSchemeForCardNumber:creditCard.number]; //fetch card scheme
    creditCard.ownerName = @"XXXXXXXX"; // no special characters here
    creditCard.cvv = @"XXX";


    CTSPaymentLayer *paymentLayer = [CitrusPaymentSDK fetchSharedPaymentLayer];

    CTSPaymentDetailUpdate *paymentInfo = [[CTSPaymentDetailUpdate alloc] init];
    [paymentInfo addCard:creditCard];

    CTSContactUpdate* contactInfo;
    CTSUserAddress* addressInfo;

    contactInfo = [[CTSContactUpdate alloc] init];
    contactInfo.firstName = @"";
    contactInfo.lastName = @"";
    contactInfo.email = @"";
    contactInfo.mobile = @"";

    addressInfo = [[CTSUserAddress alloc] init];
    addressInfo.city = TEST_CITY;
    addressInfo.country = TEST_COUNTRY;
    addressInfo.state = TEST_STATE;
    addressInfo.street1 = TEST_STREET1;
    addressInfo.street2 = TEST_STREET2;
    addressInfo.zip = TEST_ZIP;


    [CTSUtility requestBillAmount:@"X" billURL:BillUrl callback: ^(CTSBill *bill , NSError *error){

        if(error){
            dispatch_async(dispatch_get_main_queue(), ^{
            });
            [UIUtility toastMessageOnScreen:error.localizedDescription];
        }
        else {
            [paymentLayer requestDirectChargePayment:paymentInfo withContact:contactInfo withAddress:addressInfo bill:bill returnViewController:self withCompletionHandler:^(CTSCitrusCashRes *citrusCashResponse, NSError *error){

                dispatch_async(dispatch_get_main_queue(), ^{
                    //                                    [self.indicatorView stopAnimating];
                    //                                    self.indicatorView.hidden = TRUE;
                });
                if(error){
                    [UIUtility toastMessageOnScreen:error.localizedDescription];
                }
                else {
                    [UIUtility toastMessageOnScreen:[NSString stringWithFormat:@"Payment Status %@",[citrusCashResponse.responseDict valueForKey:@"TxStatus"] ]];
                    //                                    [self resetUI];
                }
            }];
        }
    }];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM