如何使用 payflow pro API 从存储的信用卡中扣款?
How do I charge a stored credit card with the payflow pro API?
我正在使用 PayflowPro API (Payflow_dotNET.dll) 的 PayflowNETAPI class 提交交易以存储信用卡,因此我的公司不会必须(出于 PCI 合规原因)。
我正在使用信用卡商店交易中的 PNREF 进行参考交易,但我一直收到 "RESULT=2&PNREF=&RESPMSG=Invalid tender"
我已经尝试过授权、捕获和销售交易,它们都给出了相同的结果。我究竟做错了什么?
我已多次通读 Payflow Gateway 开发人员指南和参考 (https://developer.paypal.com/docs/classic/payflow/integration-guide/)。授权、捕获和销售交易的所有示例都在请求中包含信用卡信息。有一些小部分解释和概述了信用卡上传,但从不在参考交易中使用请求的结果。
下面是一个示例应用程序和输出
string creditCardUploadRequest = "TRXTYPE=L&TENDER=C&ACCT=4111111111111111&EXPDATE=1218&CVV2=250&BILLTOFIRSTNAME=Homer&BILLTOLASTNAME=Simpson&BILLTOSTREET=350 5th Ave&BILLTOCITY=New York&BILLTOSTATE=NY&BILLTOZIP=10118&BILLTOCOUNTRY=840&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH";
var client = new PayPal.Payments.Communication.PayflowNETAPI(HostAddress: "pilot-payflowpro.paypal.com", HostPort: 443, Timeout: 90);
var ccUploadResponse = client.SubmitTransaction(ParamList: creditCardUploadRequest, RequestId: PayflowUtility.RequestId);
//place the responses into collection
var payPalCollection = new NameValueCollection();
foreach (string element in ccUploadResponse.Split('&'))
{
string[] Temp = element.Split('=');
payPalCollection.Add(Temp[0], Temp[1]);
}
Console.WriteLine("creditCardUploadRequest succeeded = {0}", payPalCollection.Get("RESPMSG") == "Approved");
string authorizationRequest = "TRXTYPE=A&ORIGID=" + payPalCollection.Get("PNREF") + "&INVNUM=ORD123456&AMT=50&COMMENT1=My Product Sale&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH";
var authorizationResponse = client.SubmitTransaction(ParamList: authorizationRequest, RequestId: PayflowUtility.RequestId);
foreach (string element in authorizationResponse.Split('&'))
{
Console.WriteLine(element);
}
Console.WriteLine("\nDONE");
Console.ReadKey();
输出:
creditCardUploadRequest 成功 = True
结果=2
PNREF=A7X08AB571EC
RESPMSG=无效投标
完成
在您的第二次调用中,您缺少变量 "TENDER=C" 。加上那个应该没问题。
"string authorizationRequest = "TRXTYPE=A&ORIGID=" + payPalCollection.Get("PNREF") + "&INVNUM=ORD123456&AMT=50&COMMENT1=My Product Sale&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH"
我正在使用 PayflowPro API (Payflow_dotNET.dll) 的 PayflowNETAPI class 提交交易以存储信用卡,因此我的公司不会必须(出于 PCI 合规原因)。 我正在使用信用卡商店交易中的 PNREF 进行参考交易,但我一直收到 "RESULT=2&PNREF=&RESPMSG=Invalid tender" 我已经尝试过授权、捕获和销售交易,它们都给出了相同的结果。我究竟做错了什么?
我已多次通读 Payflow Gateway 开发人员指南和参考 (https://developer.paypal.com/docs/classic/payflow/integration-guide/)。授权、捕获和销售交易的所有示例都在请求中包含信用卡信息。有一些小部分解释和概述了信用卡上传,但从不在参考交易中使用请求的结果。
下面是一个示例应用程序和输出
string creditCardUploadRequest = "TRXTYPE=L&TENDER=C&ACCT=4111111111111111&EXPDATE=1218&CVV2=250&BILLTOFIRSTNAME=Homer&BILLTOLASTNAME=Simpson&BILLTOSTREET=350 5th Ave&BILLTOCITY=New York&BILLTOSTATE=NY&BILLTOZIP=10118&BILLTOCOUNTRY=840&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH";
var client = new PayPal.Payments.Communication.PayflowNETAPI(HostAddress: "pilot-payflowpro.paypal.com", HostPort: 443, Timeout: 90);
var ccUploadResponse = client.SubmitTransaction(ParamList: creditCardUploadRequest, RequestId: PayflowUtility.RequestId);
//place the responses into collection
var payPalCollection = new NameValueCollection();
foreach (string element in ccUploadResponse.Split('&'))
{
string[] Temp = element.Split('=');
payPalCollection.Add(Temp[0], Temp[1]);
}
Console.WriteLine("creditCardUploadRequest succeeded = {0}", payPalCollection.Get("RESPMSG") == "Approved");
string authorizationRequest = "TRXTYPE=A&ORIGID=" + payPalCollection.Get("PNREF") + "&INVNUM=ORD123456&AMT=50&COMMENT1=My Product Sale&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH";
var authorizationResponse = client.SubmitTransaction(ParamList: authorizationRequest, RequestId: PayflowUtility.RequestId);
foreach (string element in authorizationResponse.Split('&'))
{
Console.WriteLine(element);
}
Console.WriteLine("\nDONE");
Console.ReadKey();
输出:
creditCardUploadRequest 成功 = True
结果=2
PNREF=A7X08AB571EC
RESPMSG=无效投标
完成
在您的第二次调用中,您缺少变量 "TENDER=C" 。加上那个应该没问题。
"string authorizationRequest = "TRXTYPE=A&ORIGID=" + payPalCollection.Get("PNREF") + "&INVNUM=ORD123456&AMT=50&COMMENT1=My Product Sale&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH"