General Discussion - Java Integration


I think it’s a security measure


Hi @khuative. Please advise if you are using the Java SDK from source (, or if you need assistance with troubleshooting your own implementation.


Hi @sinatra. Are you getting any errors when attempting to checkout using Express Checkout?


@paynow i tried to add the dependency using maven it couldnt resolve i then downloaded the source from your github and built my own jar include the jar in my project this is my section of code:
Paynow paynow = new Paynow(integrationId, integration_key);

Payment payment = paynow.createPayment(“Invoice 35”);

// Passing in the name of the item and the price of the item
payment.add(“Bananas”, 2.5);
payment.add(“Apples”, 3.4);

InitResponse response = paynow.send(payment);

and i get this error:
webdev.exceptions.HashMismatchException: null
at webdev.payments.Paynow.init( ~[Paynow-Java-SDK.jar:na]
at webdev.payments.Paynow.send( ~[Paynow-Java-SDK.jar:na]
at com.idrims.service.PaymentService.MakePaymentWithPaynow( ~[classes/:na]

i then tried to do the iniate payment request using a url
this is my body:
“id”: “XXX”,
“reference”: “YUIOPIU”,
“amount”: “90”,
“additionalinfo”: “6451”,
“returnurl”: “some”,
“phone”: “777936191”,
“method”: “ecocash”,
“resulturl”: “some”

on xxxx i use my integration key or integration id both give me this error:

Please advise on what i should do


@khuative We’ve sent you a private message requesting for additional information that’ll help us troubleshoot the issue.

Typically though, an Invalid Id error means that the ID is not being sent correctly, or is being malformed before being sent to Paynow. Either way, you can respond to the PM with the requested details and we’ll investigate further.


Hi @khuative, when did you download the java-sdk you are using? There was a minor update 4 days ago (from the date of this post 11/Nov/2018) and it may clear up your error. If the source you have is from before then, kindly download the latest version of the source, recompile the jar, import it into your project and try again.


@adrian ok let try to recompile the source and try again.
when can i get the official release of the jar?


I a have trying to initialise an ecocash payment using the endpoint

the full url i have generated is below.
Some how the api keeps on giving me an invalid id responce
i have used both the id and key.

1) 647e7031-2a34-4572-85ef-25967ee6e8bf&reference=2018-12-17T14:07:09.501&amount=3.0&additionalinfo=none&phone=0774957702&method=ecocash&status=Message
Can anyone point me in the right direction.
The site with these keys has been setup and is live.


Hi @mugadzap .

From your sample code, it seems you are performing GET requests (instead of POSTs) with the values included in as part of the URL. This is incorrect. The fields should be included as part of the POST form data. More importantly though, please always keep your Integration Keys SECRET and never share them publicly. You will need to regenerate a new integration key to invalidate the one you shared here.

Lastly, using the SDK provides easy-to-use functions to perform the initiate transaction and abstracts all the low level tasks like creating the POST object, and hash generation etc. You can read more about it here:


I have been using the sdk the version that is there is corrupt . if you open the folder under .m2 there is only a file

look @ that postman response.


Hi @mugadzap, in postman, send your key value pairs in the body of the request as x-www-form-urlencoded, not params as you have done above. Also note that the hash field is required as part of your key value pairs as described here and you can read more about how to generate one here.

Invalid Hash When Initiating a RemoteTransaction

To reiterate on a point made earlier, AVOID posting confidential keys in public forums.


from the documentation a hash is to be provided after a response . But if i am initialising a transaction which value do i use a hash


The Hash field is required as part of the post data. Please refer to this link for more information.


And the corrupt library ?


Could not resolve dependencies for project Failed to collect dependencies at zw.paynow:java-sdk:jar:LATEST: Failed to read artifact descriptor for zw.paynow:java-sdk:jar:LATEST: Failed to resolve version for zw.paynow:java-sdk:jar:LATEST: Could not find metadata zw.paynow:java-sdk/maven-metadata


Hi @mugadzap. As mentioned earlier in this thread, the publishing process is taking longer than anticipated.
In the meantime, kindly download the latest sdk here, compile it into a Jar file and import it into your project.


So i have figured it out and your documentation lacks some critical steps. Its way off from what needs to be done.



Hi @mugadzap
Please let us know the areas you found the documentation lacking so that we can improve on them for the benefit of the rest of community. Thanks :slight_smile: