Skip to main content
A few days ago, creating a payUrl to get a payment QR code went very well, however, today when testing the payment function again, even though there was no error during the order creation process and when checking the transaction status, the order still exists, but my payUrl is displayed as in the picture below, why is that?

 

Can you share the error from the Postman, calling the API directly ?


Here is the result when calling the API, absolutely no error, however payUrl is still not accessible

 


I checked the transaction status via orderId, and it said "transaction has been initiated, awaiting payment"

 


const test = async () => {
//https://developers.momo.vn/#/docs/en/aiov2/?id=payment-method
//parameters
var accessKey = 'F8BBA842ECF85';
var secretKey = 'K951B6PE1waDMi640xX08PD3vg6EkVlz';
var orderInfo = 'pay with MoMo';
var partnerCode = 'MOMO';
var redirectUrl = 'google.com';
var ipnUrl = 'https://webhook.site/b3088a6a-2d17-4f8d-a383-71389a6c600b';
var requestType = 'payWithMethod';
var amount = '50000';
var orderId = partnerCode + new Date().getTime();
var requestId = orderId;
var extraData = '';
var paymentCode =
'T8Qii53fAXyUftPV3m9ysyRhEanUs9KlOPfHgpMR0ON50U10Bh+vZdpJU7VY4z+Z2y77fJHkoDc69scwwzLuW5MzeUKTwPo3ZMaB29imm6YulqnWfTkgzqRaion+EuD7FN9wZ4aXE1+mRt0gHsU193y+yxtRgpmY7SDMU9hCKoQtYyHsfFR5FUAOAKMdw2fzQqpToei3rnaYvZuYaxolprm9+/+WIETnPUDlxCYOiw7vPeaaYQQH0BF0TxyU3zu36ODx980rJvPAgtJzH1gUrlxcSS1HQeQ9ZaVM1eOK/jl8KJm6ijOwErHGbgf/hVymUQG65rHU2MWz9U8QUjvDWA==';
var orderGroupId = '';
var autoCapture = true;
var lang = 'vi';

//before sign HMAC SHA256 with format
//accessKey=$accessKey&amount=$amount&extraData=$extraData&ipnUrl=$ipnUrl&orderId=$orderId&orderInfo=$orderInfo&partnerCode=$partnerCode&redirectUrl=$redirectUrl&requestId=$requestId&requestType=$requestType
var rawSignature =
'accessKey=' +
accessKey +
'&amount=' +
amount +
'&extraData=' +
extraData +
'&ipnUrl=' +
ipnUrl +
'&orderId=' +
orderId +
'&orderInfo=' +
orderInfo +
'&partnerCode=' +
partnerCode +
'&redirectUrl=' +
redirectUrl +
'&requestId=' +
requestId +
'&requestType=' +
requestType;
//puts raw signature
console.log('--------------------RAW SIGNATURE----------------');
console.log(rawSignature);
//signature
const crypto = require('crypto');
var signature = crypto.createHmac('sha256', secretKey).update(rawSignature).digest('hex');
console.log('--------------------SIGNATURE----------------');
console.log(signature);

//json object send to MoMo endpoint
const requestBody = JSON.stringify({
partnerCode: partnerCode,
partnerName: 'Test',
storeId: 'MomoTestStore',
requestId: requestId,
amount: amount,
orderId: orderId,
orderInfo: orderInfo,
redirectUrl: redirectUrl,
ipnUrl: ipnUrl,
lang: lang,
requestType: requestType,
autoCapture: autoCapture,
extraData: extraData,
orderGroupId: orderGroupId,
signature: signature,
});
const option = {
method: 'POST',
url: 'https://test-payment.momo.vn/v2/gateway/api/create',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(requestBody),
},
data: requestBody,
};
let result;
try {
result = await axios(option);
return result.data;
} catch (err) {
throw err;
}
};

 i used the code in this payment/nodejs/CollectionLink.js at master · momo-wallet/payment (github.com) to test but nothing change 😕 is this Momo’s problem? 

 


Reply