Paynow java spring api

Paynow has been in existence for some time now and it’s been in use by most web developers who want to introduce payments to the websites for the Zimbabwean market, it seems there is limited documentation on using the Paynow API with java and I hope this can help those java developers that want to use the API.

You can get more information on what Paynow is from here

I have just finished on the first release of the payment API which currently supports Paynow integration. The API is for java spring developers, I will go into detail on how you can add this to your java spring application

Setting up 

  1. add the repository with the API to your maven repository configurations. The repository URL is
  2. add the payment dependency to application pom



  1. The API has its own bean configuration class, in order to initialize the beans defined in the payment api. The bean configuration class is PayNowConfiguration , the configurations are dependent on the RestTemplate service and so you need to make sure you have a RestTemplate bean defined. You can use the

to import the configuration for the payment api.

  1. Now that you have the API added to your application you now need to add the environment properties required access the paynow service.




NB, the paynow.config.webapproot configuration is the root url of your webapplication

Using the API

The API is fairly simple to use,

  • Initialising payment

Inject the Paynow Bean you can use the

@Autowired Paynow paynow;    or you can use setter injection

The method call for initializing a payment is postPaynowPaymePaynowPaymentInitialiseRequestWrapper(PaynowPaymentInitialiseRequestWrapper paynowWrapper) 

Additional information on the method and parameters can be found here

  • Polling for update on payment

Inject the Paynow bean as shown above, the method call to make when polling for an update on a payment that has been initialized is

postPollRequest(String pollurl)

The pollurl is returned as a field in the response from initializing the paynow payment

You can check additional documentation from here

  • Receiving payment update

To receive updates from paynow on payments that been done, develop a Bean that implements the interface PaynowReceiverProcessorService

public class PaynowReceiverProcessorServiceImpl implements PaynowReceiverProcessorService{…. 


Your bean configuration should include the following

@BeanPublic PaynowReceiverProcessorService paynowReceiverProcessorService(){

return new PaynowReceiverProcessorServiceImpl();//This can be modified to add constructor injection or to set //other parameters


Your implementation class will have logic on how you want to handle the update information from Paynow. You can get additional documentation on the interface from here

That’s the end to this API, will update this as I get feedback and make changes to the API.

code is available on github





Passionate software engineer with keen interest in solving world problems using technology.He has vast experience in developing enterprise solutions from Telecommunications ,Media,Banking and Consultancy.

You May Also Like

BigchainDB Java Spring boot

Leave a Reply

Your email address will not be published. Required fields are marked *