我正在 try catch 已使用 PayPal 按钮授权的 PayPal 交易。我正在尝试使用 CyberSource Simple Order API 来执行此操作。我只有 3 条似乎从 PayPal 按钮返回的信息是:payerID
、paymentID
和 paymentToken
。我已经尝试了几种将其传递给 Simple Order API 的方法,但总是在响应中得到一个带有 DECLINE
消息的 102 代码。 Cybersource 的日志系统表明这是因为 以下请求字段无效或缺失:request_token
。
我是否需要通过网络资源进行整个交易(授权和获取)?或者我可以通过什么方式获取 paypal 生成的按钮并授权交易,然后通过 CyberSource 捕获它?
这是我的 CyberSource SOAPI 请求的代码片段:
RequestMessage request = new RequestMessage
{
merchantID = WebConfigurationManager.AppSettings["cybs.merchantID"]
, payPalDoCaptureService = new PayPalDoCaptureService {
run = "true"
, invoiceNumber = orders
, paypalAuthorizationId = authId
, paypalAuthorizationRequestToken = requestToken
, completeType = "Complete" }
, clientApplication = "MyClient Application"
, clientApplicationVersion = "2.0"
, clientApplicationUser = userName
, clientEnvironment = WebConfigurationManager.AppSettings["Tier"]
, merchantReferenceCode = orders
, customerID = OrderConstants.CustomerNumber
, merchantDefinedData = new MerchantDefinedData { field1 = "Customer #: " + OrderConstants.CustomerNumber, field2 = orders }
, purchaseTotals = new PurchaseTotals { currency = "usd", grandTotalAmount = total, taxAmount = taxtotal }
, item = items.ToArray()
};
ReplyMessage reply = new ReplyMessage();
try
{
reply = SoapClient.RunTransaction(request);
}
catch (Exception ex)
{
reply.decision = "SYSTEM ERROR";
reply.additionalData = string.Format("Error processing request. Exception message: {0}", ex.Message);
}
最佳答案
您是否尝试过这样设置您的请求?不要注意我使用的值,但我正在查看文档中的示例 (Example 21 Request for payPalDoCaptureService).您需要按 ctrl+f 才能找到它。
RequestMessage request = new RequestMessage
{
payPalDoCaptureService_run=true
, merchantID = WebConfigurationManager.AppSettings["cybs.merchantID"]
, merchantReferenceCode = HTNsubscription9647
, purchaseTotals = new PurchaseTotals { currency = "usd", grandTotalAmount = total, taxAmount = taxtotal }
, payPalDoCaptureService = new PayPalDoCaptureService
{
run = "true"
, invoiceNumber = orders
, paypalAuthorizationId = authId
, paypalAuthorizationRequestID = authReqId
, paypalAuthorizationRequestToken = requestToken
, completeType = "Complete"
}
}
关于c# - CyberSource 简单订单 API 捕获 PayPal 交易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45740394/