Direct Carrier Billing Android/iOS Sdk



Description

Documentation and example of Digital Virgo Direct Carrier Billing (from now on DCB) SDK for Android (Including Android TV) and iOS (Including tvOS)

Following this guide your app will be techically enabled to be promoted and integrated with Digital Virgo mobile payment.

After the integration of the sdk the resultant app can check if the user coming from Digital Virgo acquisition (optionally with explicit login with msdisdn+pin) and can check expiration date and several informations.


This integration can be used in apps already published on Google Play/App Store or only in case of Android environment, outside Google Play.



Requirements


Android Studio ™ with Gradle 2.x+
or
XCode 10+ ™ with Carthage

Java/Kotlin/Swift


Getting Started with Android java integration


Follow this documention that you find on this link DCB Android Documentation



Getting Started with iOS swift integration

You can download this project on iOS App Test for test and see the behavior.



Step 1 / 4 - Download dependencies with carthage

Create a Cartfile or add belows line on Cartfile

Open the terminal and run "carthage update". This will fetch dependencies into a Carthage folder and build each source based framework or download the pre-builded framework.

Note: This SDK support the Carthage dependency. If the first time that you use Carthage, you can learn more on this link https://github.com/Carthage/Carthage



Step 2 / 4 - Add framework to your project

On your application targets’ General settings tab, in the “Linked Frameworks and Libraries” section, drag and drop the "DCBApiExt" and "Newton" frameworks from the Carthage build folder on disk.



Step 3 / 4 - Build Phases settings

On your application targets Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

Add the paths to the frameworks you want to use under “Input Files". In our case:

$(SRCROOT)/Carthage/Build/iOS/DCBApiExt.framework
$(SRCROOT)/Carthage/Build/iOS/Newton.framework




Step 4 / 4 - Add the user verification

You can now implement the code for this SDK, on you project:

          
      
  import DCBApiExt

  var dcbApiClient: (baseDomain: String, confInfoDomain: String, apikey: String, catalog: String, country: String, namespace: String) {
        return ("<baseDomain>", "<confInfoDomain>", "<key>", "<service-key>", "<country>", "<storage-space>")
    }

  let client = DCBApiClient(baseDomain: dcbApiClient.baseDomain,
                                  confInfoDomain: dcbApiClient.confInfoDomain,
                                  apikey: dcbApiClient.apikey,
                                  catalog: dcbApiClient.catalog,
                                  country: dcbApiClient.country,
                                  namespace: dcbApiClient.namespace)

  DCBUserManager(client: client).checkFlowDCB(isActive: false) { date in
            if let dcbUser = DCBUserManager.dcbUser {
                  //User is recognised as Digital Virgo Acquisition​

                if let date = date {
                    //User is subscribed

                }
                else {
                    //User expired, not subscribed​
                    //user must pay again to access the product​
                }
            }
            else {
              //Normal user discover the app from AppStore
            }
  }
      
          


Hooray! You have finished the integration.
Do you have the expected result? No?

Get in touch with Native apps team dvs-apps@digitalvirgo.com





Best from
Native App Team