【发布时间】:2019-09-04 22:05:33
【问题描述】:
我正在尝试将 sofort 作为支付选项集成到我的节点 js 应用程序中,到目前为止一切正常。我唯一的问题是,我收到付款后不知道如何执行功能。现在我只被重定向到 sofort,转移我的钱,然后被重定向到成功 URL,但我不知道如何给服务器一个迹象,表明已收到付款。 我以为我可以使用通知 URL 作为与服务器通信的一种方式,但它不发送 GET 或 POST 请求,因此我真的不知道它实际上做了什么
到目前为止,这是我的代码:
router.get('/sofort', function(req, res, next) {
'use strict';
var util = require('util');
var Sofort = new (require('node-sofort'))({
configKey : '181556:493374:5c3627c5d50e1f77ee0f5824abb46084'
});
try {
Sofort.createPayment(101.00, 'EUR', ['Demo1'], {
user_variables: ['variable1','variable2','variable3'],
success_url: 'http://localhost:3000/',
success_link_redirect: true,
notification_urls: 'http://localhost:3000/testo'}, function (err,
data) {
console.log(data);
console.log(data.payment_url);
res.redirect(data.payment_url)
});
} catch (e) {
console.log(e);
}
)}
如果你有什么想法,那就直说吧
【问题讨论】:
-
你需要正确使用你的success_url,
success_url - String (255) Success link, overwrites the default value from the project settings. Is called when your customer successfully executed SOFORT Banking and the transfer has been listed in the customer's online banking. If the transaction ID of SOFORT Banking should be used as part of the URL, the parameter '-TRANSACTION-' can be inserted in the URL String. If no success link is defined in the project settings this parameter becomes mandatory { success_url: 'https://www.example.com/sofort/success' } -
您需要在您的节点服务器上创建一个正确的 url,以便能够重定向到并接收数据。
标签: node.js integration payment-gateway