Integrating Paynow into android applications


#1

Hi,can anyone help how to integrate Paynow into android application? The module dependency is still not working.


#2

Hi @adite. Thanks for getting in touch. In order to integrate with Android applications, kindly download the latest Java SDK, open the project in a Java IDE, build a jar file then import the resulting Jar file into your Android project and everything should work as per documentation.


#3

Thank you. @adrian I will try with Java IDE.


#4

@adrian You can now add the Paynow Java SDK as a dependency from Maven central. It is now working.

Add the following:
repositories {
mavenCentral()
}

dependencies {
compile group: ‘zw.co.paynow’, name: ‘java-sdk’, version: ‘1.+’
}


#5

Hi @tzifudzi. Thanks for the heads up.


#6

Android uses gradle so eventually one has to add a line like this in build.gradle
implementation "blah blah "

You might face a problem there


#7

Still starting with integration but this helped me get started:

1. Added the below line in my app level gradle:
implementation ‘zw.co.paynow:java-sdk:1.+’

2. Added these in my top level build file:

repositories {
google()
jcenter()
mavenCentral()
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url “https://mavenrepository.com/artifact/zw.co.paynow/java-sdk
}
}
}


#8

Spot on @sinatra. I have just looked it up and as of Gradle 3.0+, compile should be replaced with implementation.


#9

Hi @nmp263, may you kindly give more details on the exact error you are getting.

I tested the Java sdk with gradle 4.10 and this is what was in my build.gradle file

plugins {
    id 'java'
}

group 'com.adrian.test'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    implementation group: 'zw.co.paynow', name: 'java-sdk', version: '1.+'
}

I then set up a separate project to test with Maven and this is what was in my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>zw.co.adrian.what</groupId>
    <artifactId>Testing mave</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/zw.co.paynow/java-sdk -->
        <dependency>
            <groupId>zw.co.paynow</groupId>
            <artifactId>java-sdk</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>


</project>

Paynow integration with Mobile applications