Initiating transaction with paynow


#1

Hello all,

I am trying to integrate paynow to our platform and I have some questions.
I want to show user an input to enter the amount he wants to deposit and we will have his phone number.
In the documentation I found the form of request (https://developers.paynow.co.zw/docs/initiate_transaction.html) that should be sent and it doesn’t have any information about user phone number?
How do you find out who is the user whom you should do the transaction?

This is the form of data I am sending to you:
request.put(“id”, integrationId);
request.put(“reference”, depositInit.getId());
request.put(“amount”, depositInit.getAmount());
request.put(“returnurl”, getClientConfiguration().getReturnUrl());
request.put(“resulturl”, getClientConfiguration().getResultUrl());
request.put(“status”, “Message”);

String hash = generateHash(request);
request.put(“hash”, hash);

and I am sending this with post to “https://www.paynow.co.zw/interface/initiatetransaction

Can someone help me please ?


#2

Hi @betpawa. You can pass data as GET in the return url and result url. This way, when the user is redirected from paynow and when paynow responds, you have enough information to identify the transaction.

Paynow paynow = new Paynow("INTEGRATION_ID", "INTEGRATION_KEY");

String returnUrl = "example.com/return?gateway=paynow&mobile=0771111111";
String resultUrl = "example.com/result?gateway=paynow&mobile=0771111111";

paynow.setResultUrl(resultUrl);
paynow.setReturnUrl(returnUrl);

#3

But we don’t want user to be redirected to paynow website. We want to show user an input for amount of money he/she wants to deposit in our website and rest queries to server to server. Is it possible to do it at all?

Do you have any newer documentation if possible please?


#4

Guys I started using Payment api and now I am using sendMobile() method. But I am getting an exception:
Auth email is required for mobile transactions. Please pass a valid email address to the createPayment method

I am using Java SDK.

Can someone help please. In the documentation authemail is said to be optional.

And one more thing is that in documentation it is written like that:

NOTE: The integration ID being used for a mobile money transaction cannot be in test mode. The integration ID must also have an Ecocash payment method selected for use in the Paynow setup area.

How can we test the integration if we can’t use integration in test mode?


#5

hi @betpawa, here is a working example for mobile payments:
Note, you can only use designated numbers for testing mobile payments found here.

import webdev.core.*;
import webdev.payments.Paynow;
import webdev.payments.Payment;

public class MobilePayment {
    public static void main(String[] args) {
        Paynow paynow = new Paynow(SomeClass.INTEGRATION_ID, SomeClass.INTEGRATION_KEY);

        // Create a mobile payment
        Payment payment = paynow.createPayment("Invoice 32", "[email protected]");

        // Add items to the payment
        payment.add("Bananas", 6);
        // payment.add("Apples", 3.4);

        InitResponse response = paynow.sendMobile(payment, "0771111111", "ecocash");

        if(response.success())
        {
            // Get the poll url of the transaction so you can check if the payment has been made
            String pollUrl = response.pollUrl();

            System.out.println("Use this to check if paid: " + pollUrl);
        } else {
            System.out.println("There was an error somewhere");
        }
    }
}

#6

Further to the above, if you are not collecting an email address from your customer and only have their mobile number, please submit [email protected] (eg [email protected]) in place of customer email address and enture that you null route/ black hole the emails on your server. For avoidance of doubt, you should NOT submit the the same email address for all customers/transactions and your mailserver must NOT respond with a bounce (address does not exist) message.