Skip to content

2.1 Wallet Payments

Mukesh Patil - Sr. iOS Engineer edited this page Dec 7, 2016 · 1 revision

Paying through SimpliPay will enable the user using any of the payment instrument like Prepaid and/or MVC and/or Cards and/or Net-Banking and LoadMoney.

The user can choose to pay using just one or a combination of above payment modes.

Before exploring payment feature you should refer specific SDK features consumption on the basis of scope of the user (Full or Limited scope) refer for more details

Initiate Payment

Payment Using Prepaid (Citrus Cash) (If the Prepaid balance is sufficient)

// Set your payment type here
PaymentType *paymentType =

// If you wish to use BillURL follow below signature
[PaymentType citrusCashPayment:@"set your total transaction amount here"
                       billUrl:@"set your bill generator URL here" // pass BillURL string
                       contact:@"set your contact info here"
                       address:@"set your address info here"];
// Optional
// Or if you wish to use CTSBill object follow below signature
[PaymentType citrusCashPayment:@"set your total transaction amount here"
                    billObject:@"set your CTSBill object here" // pass CTSBill object
                       contact:@"set your contact info here"
                       address:@"set your address info here"];

// Pay using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Payment Using MVC (Merchant Virtual Currency) (If the MVC balance is sufficient)

// Set your payment type here
PaymentType *paymentType =

// If you wish to use BillURL follow below signature
[PaymentType mvcPayment:@"set your total transaction amount here"
                billUrl:@"set your bill generator URL here" // pass BillURL string
                contact:@"set your contact info here"
                address:@"set your address info here"];
// Optional
// Or if you wish to use CTSBill object follow below signature
[PaymentType mvcPayment:@"set your total transaction amount here"
             billObject:@"set your CTSBill object here" // pass CTSBill object
                contact:@"set your contact info here"
                address:@"set your address info here"];

// Pay using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Split Payments

Split Payments allow the users to pay partial amount using the wallet and remaining amount using other payment options such as Credit Card, Debit Card or Net-banking.

Suppose: Total Transaction Amount is ₹ 100, Prepaid Balance: ₹ 50 and MVC Balance: ₹ 50

Split Payments using MVC + Prepaid

// Set your payment type here
PaymentType *paymentType =

// If you wish to use BillURL follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
                  billUrl:@"set your bill generator URL here" // pass BillURL string
                   useMVC:YES
                  useCash:YES
            paymentOption:nil
                  contact:@"set your contact info here"
                  address:@"set your address info here"];
// Optional
// Or if you wish to use CTSBill object follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
               billObject:@"set your CTSBill object here" // pass CTSBill object
                   useMVC:YES
                  useCash:YES
            paymentOption:nil
                  contact:@"set your contact info here"
                  address:@"set your address info here"];

// Pay using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Split Payments using MVC + Other Payment Option

Net-Banking
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions netBankingOption:@"set your bank name here"
                         issuerCode:@"set your issuer code here"];
Or Credit Card
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions creditCardOption:@"set your card number here"
                     cardExpiryDate:@"set your expiry date here" // only mm/yyyy format
                                cvv:@"set your cvv here"];
Or Debit Card
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions debitCardOption:@"set your card number here"
                    cardExpiryDate:@"set your expiry date here" // only mm/yyyy format
                               cvv:@"set your cvv here"];
// Set your payment type here
PaymentType *paymentType =

// If you wish to use BillURL follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
                  billUrl:@"set your bill generator URL here" // pass BillURL string
                   useMVC:YES
                  useCash:NO
            paymentOption:paymentOption
                  contact:@"set your contact info here"
                  address:@"set your address info here"];
// Optional
// Or if you wish to use CTSBill object follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
               billObject:@"set your CTSBill object here" // pass CTSBill object
                   useMVC:YES
                  useCash:NO
            paymentOption:paymentOption
                  contact:@"set your contact info here"
                  address:@"set your address info here"];

// Pay using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Split Payments using Preapaid + Other Payment Option

Net-Banking
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions netBankingOption:@"set your bank name here"
                         issuerCode:@"set your issuer code here"];
Or Credit Card
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions creditCardOption:@"set your card number here"
                     cardExpiryDate:@"set your expiry date here" // only mm/yyyy format
                                cvv:@"set your cvv here"];
Or Debit Card
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions debitCardOption:@"set your card number here"
                    cardExpiryDate:@"set your expiry date here" // only mm/yyyy format
                               cvv:@"set your cvv here"];
// Set your payment type here
PaymentType *paymentType =

// If you wish to use BillURL follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
                  billUrl:@"set your bill generator URL here" // pass BillURL string
                   useMVC:NO
                  useCash:YES
            paymentOption:paymentOption
                  contact:@"set your contact info here"
                  address:@"set your address info here"];
// Optional
// Or if you wish to use CTSBill object follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
               billObject:@"set your CTSBill object here" // pass CTSBill object
                   useMVC:NO
                  useCash:YES
            paymentOption:paymentOption
                  contact:@"set your contact info here"
                  address:@"set your address info here"];

// Pay using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Split Payments using MVC + Prepaid + Other Payment Option

Suppose: Total Transaction Amount is ₹ 150, Prepaid Balance: ₹ 50 and MVC Balance: ₹ 50

Net-Banking
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions netBankingOption:@"set your bank name here"
                         issuerCode:@"set your issuer code here"];
Or Credit Card
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions creditCardOption:@"set your card number here"
                     cardExpiryDate:@"set your expiry date here" // only mm/yyyy format
                                cvv:@"set your cvv here"];
Or Debit Card
// Remaining amount to be paid using other payment option is 50.

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions debitCardOption:@"set your card number here"
                    cardExpiryDate:@"set your expiry date here" // only mm/yyyy format
                               cvv:@"set your cvv here"];
// Set your payment type here
PaymentType *paymentType =

// If you wish to use BillURL follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
                  billUrl:@"set your bill generator URL here" // pass BillURL string
                   useMVC:YES
                  useCash:YES
            paymentOption:paymentOption
                  contact:@"set your contact info here"
                  address:@"set your address info here"];
// Optional
// Or if you wish to use CTSBill object follow below signature
[PaymentType splitPayment:@"set your total transaction amount here"
               billObject:@"set your CTSBill object here" // pass CTSBill object
                   useMVC:YES
                  useCash:YES
            paymentOption:paymentOption
                  contact:@"set your contact info here"
                  address:@"set your address info here"];

// Pay using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Calculate Payment Distribution

This will return you amount distribution on basis of entered transaction amount & help you to determine further payment option is required or not to complete the split payment.

Suppose: Total Transaction Amount is ₹ 100, Prepaid Balance: ₹ 50 and MVC Balance: ₹ 0

{
    "useMVC": "NO",
    "useCash": "YES",
    "enoughMVCAndCash": "NO",
    "mvcAmount": "0.0"
    "cashAmount": "50.0",
    "remainingAmount": "50.0",
    "totalAmount": "100.00",
}

Or Suppose: Total Transaction Amount is ₹ 100, Prepaid Balance: ₹ 50 and MVC Balance: ₹ 50

{
    "useMVC": "YES",
    "useCash": "YES",
    "enoughMVCAndCash": "YES",
    "mvcAmount": "50.0"
    "cashAmount": "50.0",
    "remainingAmount": "0.0",
    "totalAmount": "100.00",
}

It will return you determinant response & you to have manage further required payment option on the basis "enoughMVCAndCash" bool value & split your amount to proceed further.

Overall this will useful when your planing to display users consumer profile (saved accounts) & on the basis of this response you can easily manage payment selection to proceed further.

[paymentLayer requestCalculatePaymentDistribution:@"set your total transaction amount here"
                                completionHandler:^(CTSSimpliChargeDistribution *amountDistribution,
                                                    NSError *error) {
                                    if (error) {
                                        NSLog(@"error %@", [error localizedDescription]);
                                    }
                                    else {
                                        CTSPaymentOptions *debitCardPayment = nil;
                                        if (!amountDistribution.enoughMVCAndCash) {
                                            debitCardPayment = [CTSPaymentOptions
                                                                debitCardOption:@"4111111111111111"
                                                                cardExpiryDate:@"01/18"
                                                                cvv:@"000"];
                                        }
                                        
                                        // Set your payment type here
                                        PaymentType *paymentType =
                                        
                                        // If you wish to use BillURL follow below signature
                                        [PaymentType PGPayment:@"set your total transaction amount here"
                                                    setBillURL:@"set your bill generator URL here"// pass BillURL
                                              setPaymentOption:paymentOption
                                                setContactInfo:@"set your contact info here"
                                                setAddressInfo:@"set your address info here"];
                                        
                                        // Pay using simplified payment interface
                                        [paymentLayer requestSimpliPay:paymentType
                                               andParentViewController:self
                                                     completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                                                         NSError *error) {
                                                         if (error) {
                                                             NSLog(@"error %@", [error localizedDescription]);
                                                         }
                                                         else {
                                                             NSLog(@"response %@", paymentReceipt.toDictionary);
                                                         }
                                                     }];
                                    }
                                }];

###Load Money into Users Citrus Prepaid Account

Money can be loaded/added into users Citrus account using following method, this can be done using direct payments as well as saved cards.

Load Money Using Saved Payment Instruments (A.K.A. Tokenized payments)

Saved payment instruments like CC, DC and NB Payments (A.K.A. Tokenized payments) Obtain users saved cards / NB and use this method to pay using saved payment instruments, Citrus server returns a token in each of the saved accounts. You only need send this token and CVV (cvv is not saved along with the other card information only in case of card payment) for doing the payment, rest of the information will be fetched by the Citrus server from its database using this token.

Net-Banking Tokenized
// Step 1 - Get All the saved instruments.(requestPaymentInformationWithCompletionHandler method of SDK).
// Step 2 - Display List on the UI.
// Step 3 - If option selected by user is Netbanking Option, set Netbanking Option to NetBankingTokenized method.

// Parse the selected paymentOptionsList dictionary to CTSConsumerProfileDetails model object
JSONModelError* jsonError;
CTSConsumerProfileDetails* consumerProfileDetails = [[CTSConsumerProfileDetails alloc]
                                                     initWithDictionary:[consumerProfile.paymentOptionsList
                                                                         objectAtIndex:selectedRow]
                                                     error:&jsonError];

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions netBankingTokenized:consumerProfileDetails];
Or Credit Card Tokenized
// Step 1 - Get All the saved instruments.(requestPaymentInformationWithCompletionHandler method of SDK).
// Step 2 - Display List on the UI.
// Step 3 - If option selected by user is CardOption, call set CVV method and set payment option to CreditCardTokenized method.

// Parse the selected paymentOptionsList dictionary to CTSConsumerProfileDetails model object
JSONModelError* jsonError;
CTSConsumerProfileDetails* consumerProfileDetails = [[CTSConsumerProfileDetails alloc]
                                                     initWithDictionary:[consumerProfile.paymentOptionsList
                                                                         objectAtIndex:selectedRow]
                                                     error:&jsonError];

// Set the CVV for cardOption
[consumerProfileDetails setCvv:@"set your cvv here"];

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions creditCardTokenized:consumerProfileDetails];
Or Debit Card Tokenized
// Step 1 - Get All the saved instruments.(requestPaymentInformationWithCompletionHandler method of SDK).
// Step 2 - Display List on the UI.
// Step 3 - If option selected by user is CardOption, call set CVV method and set payment option to DebitCardTokenized method.

// Parse the selected paymentOptionsList dictionary to CTSConsumerProfileDetails model object
JSONModelError* jsonError;
CTSConsumerProfileDetails* consumerProfileDetails = [[CTSConsumerProfileDetails alloc]
                                                     initWithDictionary:[consumerProfile.paymentOptionsList
                                                                         objectAtIndex:selectedRow]
                                                     error:&jsonError];

// Set the CVV for cardOption
[consumerProfileDetails setCvv:@"set your cvv here"];

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *paymentOption =
[CTSPaymentOptions debitCardTokenized:consumerProfileDetails];
// Set your payment type here
PaymentType *paymentType =
[PaymentType loadMoney:@"set your total transaction amount here"
             returnUrl:@"set your return URL here"
         paymentOption:paymentOption
          customParams:@"set your custom params here"
               contact:@"set your contact info here"
               address:@"set your address info here"];

// Load money using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Load Money Using Net-Banking

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *bankPayment =
[CTSPaymentOptions netBankingOption:@"set your bank name here"
                         issuerCode:@"set your issuer code here"];

// Set your payment type here
PaymentType *paymentType =
[PaymentType loadMoney:@"set your total transaction amount here"
             returnUrl:@"set your return URL here"
         paymentOption:bankPayment
          customParams:@"set your custom params here"
               contact:@"set your contact info here"
               address:@"set your address info here"];

// Load money using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Load Money Using Debit Card

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *debitCardPayment =
[CTSPaymentOptions debitCardOption:@"set your card number here"
                    cardExpiryDate:@"set your expiry date here"//only mm/yyyy format
                               cvv:@"set your cvv here"];

// Set your payment type here
PaymentType *paymentType =
[PaymentType loadMoney:@"set your total transaction amount here"
             returnUrl:@"set your return URL here"
         paymentOption:debitCardPayment
          customParams:@"set your custom params here"
               contact:@"set your contact info here"
               address:@"set your address info here"];

// Load money using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];

Load Money Using Credit Card

// Create instance for CTSPaymentOptions Class & set required payment details.
CTSPaymentOptions *creditCardPayment =
[CTSPaymentOptions creditCardOption:@"set your card number here"
                     cardExpiryDate:@"set your expiry date here"//only mm/yyyy format
                                cvv:@"set your cvv here"];

// Set your payment type here
PaymentType *paymentType =
[PaymentType loadMoney:@"set your total transaction amount here"
             returnUrl:@"set your return URL here"
         paymentOption:creditCardPayment
          customParams:@"set your custom params here"
               contact:@"set your contact info here"
               address:@"set your address info here"];

// Load money using simplified payment interface
[paymentLayer requestSimpliPay:paymentType
       andParentViewController:self
             completionHandler:^(CTSPaymentReceipt *paymentReceipt,
                                 NSError *error) {
                 if (error) {
                     NSLog(@"error %@", [error localizedDescription]);
                 }
                 else {
                     NSLog(@"response %@", paymentReceipt.toDictionary);
                 }
             }];