An error occured while initiating transaction Error: Hashes do not match! at Paynow.parse


#21

What i am trying to access is if you can actually receive a Html post on your result url . Have you sent yourself a post to the result url and were able to verify you received it ?


#22

@Harvey
You can try post anything. I am using Postman, both urls are working on my side


#23

@k1muza apologies for taking long I was trying to look through your transaction records. For integration ID-*622 , the last transaction we saw was on the 2nd of January.
Here is a successful Post to your server -->

January 2nd 2020, 11:34:17.727 IntegrationID: 8622 :: Sending to http://18.217.49.123:8080/update:
reference=Invoice%202343
paynowreference=5858966
amount=0.50
status=Paid
pollurl=https://www.paynow.co.zw/Interface/CheckPayment/?guid=2a0a06db-ee2e-4042-9ba6-cd8c762f6f64

For the same id here is a failed post to your server.–>
January 2nd 2020, 11:34:18.310 IntegrationID: 8622 :: The remote server returned an error: (404) Not Found.

Please carry out another test and let me know , I want to verify whether if we are sending a response from
server-side


#24

I have tested using my IP address of the day “13.59.170.167”
http://13.59.170.167:8080/payment/ecocash
Unfortunately there’s still nothing after the transaction. I am receiving the texts and transactions are completing but none of my urls return or result are posted on to confirm that.


#25

@k1muza below is the Post Paynow tried to send you and the response.

where you are listening : http://13.59.170.167:8080/payment/ecocash
where Paynow is posting : http://13.59.170.167:8080/update:

POST
January 13th 2020, 15:58:17.786 , IntegrationID: 8622 : Sending to http://13.59.170.167:8080/update:

reference=Invoice%202343
paynowreference=6012457
amount=0.50
status=Paid
pollurl=https://www.paynow.co.zw/Interface/CheckPayment/?guid=1368ca45-f8aa-4333-aadb-8a3ccf6ced85

RESPONSE
January 13th 2020, 15:58:18.362 IntegrationID: 8622 : The remote server returned an error: (404) Not Found…


#26

Yes I was listening to the wrong endpoint. Thanks so much for pointing that out. I think this issue is resolved.


#27

Good day all. It seems this issue was resolved for my account alone. I updated the code with a different account and integration keys, I am getting the “Hashes do not match” error again/ Lemme know how I can share the integration keys so you can test and help me


#28

@k1muza , can you please check for spaces and make sure you copied the credentials correctly. As for sharing keys, the best I can do is point you to this test scenario Invalid Hash When Initiating a RemoteTransaction


#29

Thanks for the response. I don’t think that is going to help much, because the system is working fine except the time i switch between integration keys. So deductively the issue is in the new integration key, not so much on the code. I will just need to give u my integration key and ID.

Maybe you can contact me on 0774684534 on WhatsApp. I can give you the key and ID and we test.


#30

@k1muza generate another new key and test it. Let me know how it goes


#31

I generated new keys. But on testing with the code below. I got the same error:

app.post("/checkout", async function(req, res, next) {

const ref = new Date().getTime();

const payment = paynow.createPayment(`Invoice ${ref}`, 'k1muza@gmail.com');

payment.add("Oranges", 30);
payment.add("Bread", 15);

try {
    const response = await paynow.sendMobile(payment, '0771111111', 'ecocash');
    if (response && response.success) {
      res.json(response)
    } else {
      res.json(response);
    }
} catch (e) {
  res.json(e);
    }
});

#32

Hey guys. After quite some time with everything working properly. I am getting the Hashes error again.

My server code is now being hosted here https://zim-gym.herokuapp.com


#33

I am facing the same error

An error occured while initiating transaction Error: Hashes do not match! at Paynow.parse (/Users/chinyavadav/Sentrywave/Projects/sentrypay-chatbot-service/node_modules/paynow/src/paynow.ts:206:15) at /Users/chinyavadav/Sentrywave/Projects/sentrypay-chatbot-service/node_modules/paynow/src/paynow.ts:184:19 at processTicksAndRejections (internal/process/task_queues.js:97:5) at /Users/chinyavadav/Sentrywave/Projects/sentrypay-chatbot-service/src/services/paynow.service.ts:42:34 undefined

my code is below, i have tried generating new token but still getting the same

`import { Paynow } from “paynow”;
import { MobilePaymentRequestDto, MobileMoneyWallet, PaynowItem } from “…/dtos/paynow.dto”;
export default class PaynowService {
private _integrationId: string;
private _integrationKey: string;

paynow: any;

constructor() {
    this.integrationId = process.env.PAYNOW_INTEGRATION_ID;
    this.integrationKey = process.env.PAYNOW_INTEGRATION_KEY;
    this.paynow = new Paynow(this.integrationId, this.integrationKey);
}

public get integrationId(): string {
    return this._integrationId;
}
public set integrationId(value: string) {
    this._integrationId = value;
}

public get integrationKey(): string {
    return this._integrationKey;
}
public set integrationKey(value: string) {
    this._integrationKey = value;
}

/**
 * https://developers.paynow.co.zw/docs/nodejs_quickstart.html
 * @param request 
 * @returns 
 */
createMobilePayment(request: MobilePaymentRequestDto): Promise<boolean> {
    let payment = this.paynow.createPayment(request.txnReference, "chinyavadav@gmail.com");
    request.txnItems.forEach(item => {
        payment.add(item.name, item.price);
    });
    console.log(this.paynow);
    return new Promise(async (resolve, reject) => {
        try {
            const response = await this.paynow.sendMobile(payment, request.mobilePhoneNumber, request.wallet);
            resolve(response);
        } catch (e) {
            reject(e);
        }
    })
}

pollTransaction(pollUrl: String): Promise<boolean> {
    return new Promise(async (resolve, reject) => {
        try {
            let status = await this.paynow.pollTransaction(pollUrl);
            resolve(status);
        } catch (e) {
            reject(e);
        }
    })
}

}`


#34

what about on yarn the issue is still persisting here pliz help


#35

bro im experiencing the same error how did you fix it


#36

same here, was this resolved?


#37

Omg, unbelievable.

Yes, PayNow has not done something about the error handling,
but on the docs there is a clearly written point to note.

N.B. The authemail field supplied during test mode should match one of the login email addresses for the merchant account being tested.

This means if the account you used to obtain integration keys is test@dev.io, when passing the email on the post
request, test@dev.io should be used when testing.

So I suggest a thorough reading of the docs before implementation to any developer in the future.
This is to avoid the frustration and time wasting digging into a bug, that can be avoided if we read the docs.

Till the issue is fixed, I’m out. :v:t4: