General Discussion - Java Integration


#12

I think it’s a security measure


#13

Hi @khuative. Please advise if you are using the Java SDK from source (https://github.com/paynow/Paynow-Java-SDK), or if you need assistance with troubleshooting your own implementation.


#14

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


#15

@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:283) ~[Paynow-Java-SDK.jar:na]
at webdev.payments.Paynow.send(Paynow.java:154) ~[Paynow-Java-SDK.jar:na]
at com.idrims.service.PaymentService.MakePaymentWithPaynow(PaymentService.java:127) ~[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:
status=Error&error=Invalid+Id.

Please advise on what i should do


#16

@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.


#17

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.


#18

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


#19

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)https://www.paynow.co.zw/interface/remotetransaction?id= 647e7031-2a34-4572-85ef-25967ee6e8bf&reference=2018-12-17T14:07:09.501&amount=3.0&additionalinfo=none&phone=0774957702&method=ecocash&status=Message
2) https://www.paynow.co.zw/interface/remotetransaction?id=6605&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.


#20

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: https://developers.paynow.co.zw/docs/java_quickstart.html#mobile-transactions


#21

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
resolver-status.properties.

look @ that postman response.


#22

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
#23

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


#24

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


#25

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


#26

And the corrupt library ?
image


#27

Could not resolve dependencies for project info.mushonga.search:mushonga-endpoint:jar:0.0.1-SNAPSHOT: 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


#28

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.


#29

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


#30

#31

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: