我正在尝试做重复付款与表单集成在Sagepay (现在的Opayo)。
从这里发布的前面的问题中,我得到了需要的securitykey,但没有在表单调用中返回,因此需要对getTransactionDetails命令进行额外的调用。
我有了安全密钥,现在可以打电话给https://test.sagepay.com/gateway/service/repeat.vsp开始重复付款了。但是,文档并未说明对该调用的响应将发送到何处。因此,我假设它将转到使用服务器或直接集成时与付款设置的NotificationURL。由于我使用的是Form,所以没有设置。
问题是,如果初始付款是使用表单集成创建的,是否有办法捕获对https://test.sagepay.com/gateway/service/repeat.vsp调用的响应?
我想第二个问题是,有没有人成功地使用Sagepay表单集成实现了重复付款?
发布于 2020-12-03 19:32:28
不确定这是否对你有帮助,我们没有重复付款;但我们正在考虑释放延期付款,我认为这是一种类似的方法。
如何调用'https://test.sagepay.com/gateway/service/repeat.vsp'?
您是否可以使用“HttpWebRequest”发出调用,然后在“HttpWebResponse”中捕获直接响应?
例如:
private static void DeferredSharedApiCall(Dictionary<string, string> data, string type, string url)
{
string postData = string.Join("&", data.Select(x => $"{x.Key}={HttpUtility.UrlEncode(x.Value)}"));
HttpWebRequest request = WebRequest.CreateHttp(url);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (TextWriter tw = new StreamWriter(request.GetRequestStream()))
{
tw.Write(postData);
}
HttpWebResponse response = null;
try
{
response = request.GetResponse() as HttpWebResponse;
}
catch (WebException ex)
{
//log.Error($"{type} Error, data: {postData}", ex);
}
catch (Exception ex)
{
//log.Error($"{type} Error, data: {postData}", ex);
}
if (response != null)
{
using (TextReader tr = new StreamReader(response.GetResponseStream()))
{
string result = tr.ReadToEnd();
//log.Info($"{type} Response: {Environment.NewLine}{result}");
}
}
} https://stackoverflow.com/questions/64278904
复制相似问题