Verve Payment SDK for Windows Phone 8

The Verve Payment SDK for Windows Phone 8 lets you easily add payment capability into your Windows Phone 8 application.

To download the SDK, visit the NuGet package URL. The steps below describe how you can go about integrating the SDK into your application.

Registering your application on the Developer Console

To begin integration with the Verve SDK, you have to register your application on the Developer Console. To do this, follow the steps below:

  1. Go to the Developer Console, sign-up if you haven’t. After signing-up a confirmation e-mail would be sent to you and you would have to click the link in it to confirm your e-mail. For security reasons, your application would be vetted and an e-mail would be sent to you when your application is approved.
  2. If you already have an approved login details, log-in to gain access to your console.
  3. To begin, click the “Start Integrating” button to create your first App.
    call_to_action
  4. The “New App” form comes up. Fill in the details correctly. Remember to choose “Mobile Application” for the “Application Type” field.NewApp
  5. After submitting the form, you would immediately get a sandbox Client ID. You should use this for test purposes.
  6. To expose services to the Client ID, click on the App name on the left hand side of the screen, to select it. Then click on the “Manage” button on the top right-hand side of the screen. This would display the app management page, for setting the configuration of the application.AppDashboard
  7. Scroll down to the “Services” section of the app management page and change the status of any service that you intend to use, from “OFF” to “ON”. Make sure you turn on Verve Wallet Services and Verve Services SwitchServices.
  8. Now you have the keys and access to the services, you can go ahead and create your application as you please.

Downloading and Installing the SDK
To use the SDK, visit NuGet package URL to get the instructions on how to install the SDK. Either of the steps below will get the job done.

  1. In Visual Studio select your project, then Go to VIEW → Other Windows → Package Manager Console. On the console type:
    Install-Package Verve.Sdk.Wp8

    …and press Enter. Or

  2. Go to your Solution Explorer, right-click on “References” then select “Manage NuGet Packages…” On the pop-up click “Online” at the left-hand-side, then on the search menu, type “Verve” and select “Verve Payment SDK for Windows Phone 8” and click “Install”.SampleApp

Using the SDK in your project

  1. Add the using statement for the SDK in your code: using Verve.Payment.Sdk;
  2. Initialize the VervePayment class as given:
    var vervePayment = new VervePayment(PhoneApplicationPage parent, string paymentCode, long amount, string customerId, string clientId, string clientSecret[, bool isTestPayment = true]);

    The meanings of the parameters are:

    Type Field

    Description

    PhoneApplicationPage parent This refers to the page hosting the SDK, the page where you want the SDK pop-up screen to show-up over.
    string paymentCode This refers to the payment code for the item which you want to pay for. To get a payment code, go to your Developer Console and register a new item. You’ll automatically get a payment code for the item.
    long amount This refers to the cost of the item you want to pay for. It should be in kobo (i.e. 1 NGN = 100 kobo).
    string customerId This refers to the id of the customer who is trying to perform the payment on your application. It is usually issued by you and it can be anything.
    string clientId This refers to the client ID you got from Developer Console for the particular application that you are developing.
    string clientSecret This refers to your application secret key. The value is on the same page where you got the client id. You will have to click on “Show Secret” link to see it.
    boolean isTestPayment This is an optional parameter that is set when switching from test implementation to production environment. It is true by default which means that you are running in the test implementation. NOTE: it’s very important to set the value to false in a live distribution.
  3. Add handlers to the following events: OnPaymentCompleted and OnPaymentException, on the VervePayment object. Sample code is given thus:
    vervePayment.OnPaymentCompleted += (evt) =>
        {
            //where evt is a type of PaymentCompletedEventArgs
        };
        vervePayment.OnPaymentException += (evt) =>
        {
            //where evt is a type of PaymentExceptionEventArgs
        };
  4. Call the method DoPayment() method on the VervePayment object. Check the sample below:
    var amount = 10000; //payment amount in kobo e.g. 10000=N100.00
        var vervePayment = new VervePayment(this, "10402", amount,  "0000000001", CLIENT_ID, CLIENT_SECRET);
        vervePayment.OnPaymentCompleted += (evt) => {};
        vervePayment.OnPaymentException += (evt) => {};
        vervePayment.DoPayment();

    Then call this method whenever you want to invoke the payment SDK. Both the SDK and .NET would handle the rest.

  5. Go ahead and implement your application as you please.

Sample codes and application can be found here: https://github.com/techquest/paywith-quickteller-sample-wp8

Migrating your application to Production environment

Now that you have finished developing your application and your payment process is working fine locally, you want to publish your application to the stores so that your customers can download and use it. The keys which you currently use for development won’t work in production. To acquire new keys for production, please follow the steps below:

  1. Log in to the developer console. If your application is not selected, click on your application on the left-hand side of the page to select it, then click on the “Manage” button at the top right-hand side of the screen. This takes you to the app management page.
  2. At the “status” section of the app management page, click on the switch next to “Are you ready to migrate this app to production environment?” to change it from “NO” to “YES”.
    SwichToProduction
  3. You would get an e-mail which confirms that you have requested to migrate to Production. After this, your application would be reviewed and migrated to Production, and you would get an e-mail to this regards.
  4. If approved, you would be issued a new set of keys, which you should replace the old ones in your app with.DevConProductionMode
    PLEASE NOTE: Apart from replacing the client ID and secret key, you would have to set the last optional parameter on the VervePayment constructor in your code to false. This is important, because if you don’t, requests from your application would be treated as sandbox requests.

        ...
        //set isTestPayment to false
        var vervePayment = new VervePayment(this, "10402", amount,  "0000000001", CLIENT_ID, CLIENT_SECRET, false);
        ...
  5. After you are done with this, you can go ahead and test your app in production mode and publish your app to the store when you are done.