Check Mobile App
Read now
Start a Project

CCAvenue Payment Gateway Integration In Swift

Save

Hi guys, today we will learn about how to implement CCAvenue payment gateway in an iOS application.

Before starting to code first we need to know what a payment gateway is

payment gateway is a merchant service provided by an e-commerce application service provider that authorizes credit card or direct payments processing for e-businesses, online retailers, bricks, and clicks, or traditional brick and mortar.

Thus, its enough for us now. Let’s start by following the instructions below.

STEPS TO INTEGRATE

->Download & Unzip

1. Please download the framework from below link.

https://ccavenue.ae/downloads_mcpg/mobile_sdk/CCAvenueSDK_iOS_V2.0.zip

2. Download CCAvenueSDKiOS.zip file for iOS. This contains the framework file, bundle
resources file, response handler file (ResponseHandler.jsp), RSA file (GetRSA.jsp) and
a demo app (Swift & Objective-C).

3. Unzip the downloaded CCAvenueSDKiOS.zip file anywhere on the file system.

->Upload GetRSA.jsp & ResponseHandler.jsp on Merchant Server

1. GetRSA.jsp kept on the merchant server for fetching the RSA Public Key and send the file
path URL with the request.
2. Also, ResponseHandler.jsp kept on the merchant server for the response will be sent by the
CCAvenue server to the merchant server on the return URL that was configured at the URL
that was sent in the request. Merchant should then decrypt the response, which can then be
parsed to get all transaction details and will send back to the merchant app.

->Include the SDK in Xcode Project

1. Drag the CCAvenueSDK.framework to Frameworks & CCAvenueSDK.bundle under
project in project navigator.
2. Create a new group Frameworks if it does not exist.
3. Choose to Create groups for any added folders. Make sure to select Copy files if
needed.
4. For Swift Projects add the following:
#import <CCAvenueSDK/InitialViewController.h> to the Bridging-Header.h

Note: Ensure linked once in the Linked Framework and Libraries or just drag the
CCAvenueSDK.framework to Embedded Binaries in the general tab in the project
settings.

->Please  Insert the following XML source code snippet into the body of your Info.plist file just before the final.

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

->Now Add The Below Code In Your Payment Controller.

1. Import the CCAvenue Library

2. Initialize InitialViewController and pass values in Initializer for SDK.

3. Initialize InitViewContollerDelegate for last class where you start SDK.

4. Assign an instance of the class that’s adopted the delegate protocol to its delegate property.

5. Present Initial controller of SDK to process payment.

->Finish SDK and get Response from SDK.

1. Call delegate method of InitialViewConrollerDelegate.

Note: Currently only Portrait orientation mode is supported within the CCAvenue Mobile SDK.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


11 comments

  • riya
    this is very helpful for us. great.
  • Saurabh
    Hi Sir , I have problem with CCAvenue iOS Sdk , This is just not stable .Can you tell me get rsa key dynamically?
    What is best way payment gateway integration ?
    SDK or Web
    • Zeba Hakim (Moderator)
      Hello Sir,
      Kindly contact us at [email protected]. So that we could assist you in a better way.

      Thanks and Regards.
      Zeba Hakim.

      • saba
        this is not working
        • jitendra kumar (Moderator)
          Hello,

          Kindly contact us at [email protected]. So that we could assist you in a better way.

          Thanks.

  • Ankit Gabani
    hello ,
    how are you?
    i implemented ccavenue but i got crash ap
    2021-12-24 12:00:19.136867+0530 AirGuncart[32153:371515] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]’
    *** First throw call stack:
    (
    0 CoreFoundation 0x0000000102d8f126 __exceptionPreprocess + 242
    1 libobjc.A.dylib 0x0000000102c1ff78 objc_exception_throw + 48
    2 CoreFoundation 0x0000000102e0bcdb _CFThrowFormattedException + 194
    3 CoreFoundation 0x0000000102e171f8 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.5 + 0
    4 CoreFoundation 0x0000000102dfa1ff -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 235
    5 CoreFoundation 0x0000000102d8dda3 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
    6 AirGuncart 0x00000001004cf123 -[InitialViewController addCardView] + 9283
    7 AirGuncart 0x00000001004edb56 __44-[InitialViewController fetchPaymentOptions]_block_invoke_2 + 38
    8 libdispatch.dylib 0x00000001054d58ac _dispatch_call_block_and_release + 12
    9 libdispatch.dylib 0x00000001054d6a88 _dispatch_client_callout + 8
    10 libdispatch.dylib 0x00000001054e4f23 _dispatch_main_queue_callback_4CF + 1152
    11 CoreFoundation 0x0000000102cfd276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    12 CoreFoundation 0x0000000102cf7b06 __CFRunLoopRun + 2685
    13 CoreFoundation 0x0000000102cf6b9e CFRunLoopRunSpecific + 567
    14 GraphicsServices 0x000000010b040db3 GSEventRunModal + 139
    15 UIKitCore 0x000000010c772af3 -[UIApplication _run] + 912
    16 UIKitCore 0x000000010c777a04 UIApplicationMain + 101
    17 libswiftUIKit.dylib 0x000000010428f7b2 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
    18 AirGuncart 0x0000000100448e5a $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 122
    19 AirGuncart 0x0000000100448dce $s10AirGuncart11AppDelegateC5$mainyyFZ + 46
    20 AirGuncart 0x0000000100448ea9 main + 41
    21 libdyld.dylib 0x0000000105565415 start + 1
    22 ??? 0x0000000000000001 0x0 + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]’
    terminating with uncaught exception of type NSException

    Pls help me..

    • jitendra kumar (Moderator)
      Hello,
      Kindly contact us at [email protected]. So that we could assist you in a better way.
      Thanks
      • Ankit Gabani
        hello ,
        how are you?
        i implemented ccavenue but i got crash ap
        2021-12-24 12:00:19.136867+0530 AirGuncart[32153:371515] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]’
        *** First throw call stack:
        (
        0 CoreFoundation 0x0000000102d8f126 __exceptionPreprocess + 242
        1 libobjc.A.dylib 0x0000000102c1ff78 objc_exception_throw + 48
        2 CoreFoundation 0x0000000102e0bcdb _CFThrowFormattedException + 194
        3 CoreFoundation 0x0000000102e171f8 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.5 + 0
        4 CoreFoundation 0x0000000102dfa1ff -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 235
        5 CoreFoundation 0x0000000102d8dda3 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
        6 AirGuncart 0x00000001004cf123 -[InitialViewController addCardView] + 9283
        7 AirGuncart 0x00000001004edb56 __44-[InitialViewController fetchPaymentOptions]_block_invoke_2 + 38
        8 libdispatch.dylib 0x00000001054d58ac _dispatch_call_block_and_release + 12
        9 libdispatch.dylib 0x00000001054d6a88 _dispatch_client_callout + 8
        10 libdispatch.dylib 0x00000001054e4f23 _dispatch_main_queue_callback_4CF + 1152
        11 CoreFoundation 0x0000000102cfd276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        12 CoreFoundation 0x0000000102cf7b06 __CFRunLoopRun + 2685
        13 CoreFoundation 0x0000000102cf6b9e CFRunLoopRunSpecific + 567
        14 GraphicsServices 0x000000010b040db3 GSEventRunModal + 139
        15 UIKitCore 0x000000010c772af3 -[UIApplication _run] + 912
        16 UIKitCore 0x000000010c777a04 UIApplicationMain + 101
        17 libswiftUIKit.dylib 0x000000010428f7b2 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
        18 AirGuncart 0x0000000100448e5a $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 122
        19 AirGuncart 0x0000000100448dce $s10AirGuncart11AppDelegateC5$mainyyFZ + 46
        20 AirGuncart 0x0000000100448ea9 main + 41
        21 libdyld.dylib 0x0000000105565415 start + 1
        22 ??? 0x0000000000000001 0x0 + 1
        )
        libc++abi.dylib: terminating with uncaught exception of type NSException
        *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]’
        terminating with uncaught exception of type NSException
        Pls help me..
        • jitendra kumar (Moderator)
          Hello,
          Kindly contact us at [email protected]. So that we could assist you in a better way.
          Thanks
        • Sanjeev Mehta
          Have you got the solution for it.
          • jitendra kumar (Moderator)
            Hello,
            Kindly contact us at [email protected]. So that we could assist you in a better way.
            Thanks
  • css.php

    The support is fast and do everything in their power to make it perfect. If you need customization it's also done right away. I had massive research to select Mobikul and now I'm sure it was the right one.

    Igor Souza

    Igor Souza

    Talk to Sales

    Global

    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home