SeunAdelekan/PaystackJava

[Escalated from Paystack Support] Initializing transaction returns empty response in java

Closed this issue · 3 comments

@SeunAdelekan please we need your help with this Morufu's issue as reported below:

I am using the java api wrapper library on my project which is maven web application running on glassfish 4.1. When I run this code, I am getting an empty json response.

Transactions transactions = new Transactions();
JSONObject jsonObject = new JSONObject(transactions.
initializeTransaction(AppConstants.getAlphaNumeric(20), "10000000",
"customer@email.com", "", AppConstants.getBaseUrl() + "paySuccess/" + appApiCode + "/" + usercode));
AppConstants.logger("Initializing transaction complete");
AppConstants.logger("response:"+jsonObject.toString());

out put:

Info: Initializing transaction
Info: Initializing transaction complete
Info: response{}

When I check on https://dashboard.paystack.co/#/transactions , I can see that the transaction has gone through.

Hi @ibrahimlawal, the following statement:

JSONObject jsonObject = new JSONObject(transactions.initializeTransaction(AppConstants.getAlphaNumeric(20), "10000000",
"customer@email.com", "", AppConstants.getBaseUrl() + "paySuccess/" + appApiCode + "/" + usercode));

Should be written as:

JSONObject jsonObject = transactions.initializeTransaction(AppConstants.getAlphaNumeric(20),  "10000000", "customer@email.com", "", AppConstants.getBaseUrl() + "paySuccess/" + appApiCode + "/" + usercode);

Feel free to contact me if any other issue arises!

Thankyou for the response. It worked. Can you kindly help me write a webhook in java for receiving payment success. Preferably a servlet.

Thanks @SeunAdelekan . Glad this is sorted @solokingjec 👍 Thank you for choosing Paystack