我正在使用Payplug和NodeJS。我已经使用cURL方法修改了API。
当我创建新的付款时,我没有付款编号。困难在于我将直接获得它以便将其放入我的return_url
中。
自从创建付款以来,我没有付款ID,因此无法在重定向中提出一些引人注目的HTTP_GET请求,以便对您的API进行某些调用,例如检查付款状态或付款在数据库中的存在之类的东西。
这是我当前的代码:
var PayPlugAPI = require('payplug-nodejs').PayPlugAPI;
// console.log("req.body: ", req.body)
var paymentObject=req.body
var payplugapi = new PayPlugAPI('sk_Secre', {
// the url called in case of success
return_url: 'http://localhost:3000/',
// the url called in case of cancelation
cancelReturnUrl: 'https://[my-url]/payplugapi/test/cancel?tracker=',
// the notification url. Cf. https://www.payplug.com/docs/api/apiref.html#notifications
notificationUrl: 'https://[my-url]/payplugapi/test/notifications?tracker='
});
console.log("authenticate following")
payplugapi.authenticate()
.then(function (result) {
console.log("authentication succeed, payplugapi.authenticated: ")
newPayment(payplugapi, paymentObject)
})
.fail(function(err){
console.log('Error while authenticating. Message="%s"', err.message);
})
.done();
// *****
function newPayment(payplugapi, paymentObject){
var Payment = require('payplug-nodejs').Payment
if (payplugapi.authenticated) {
// The API is successfully authenticated
console.log("in newPayment")
}
console.log("payplugapi: ", payplugapi)
任何提示都可以直接获取ID,以便将其放入重定向中, 谢谢