![](/img/trans.png)
[英]Cybersource simple order api sample application gives “The type initializer for 'CyberSource.WSSecurity.Signature' threw an exception.”
[英]CyberSource Simple Order API Capture PayPal transaction
我正在嘗試捕獲已使用PayPal按鈕授權的PayPal交易。 我正在嘗試使用CyberSource Simple Order API來執行此操作。 我只有3條信息似乎從PayPal按鈕返回: payerID
, paymentID
和paymentToken
。 我已經嘗試了幾種方法將其交給Simple Order API,但總是在響應中獲得帶有DECLINE
消息的102代碼。 Cybersource的日志記錄系統表明這是因為The following request field(s) is either invalid or missing: 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);
}
您是否嘗試過像這樣設置您的請求? 不要理會我使用的值,但我正在查看文檔中的示例(例21請求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"
}
}
我最終解決了這個問題。 我的問題涉及是否需要從端到端采用CyberSource是正確的道路。 最后我發現 - 在與CyberSource支持談了幾天之后 - 我需要在WebApi方法中使用他們的“Set Service”來生成PayPal“令牌”並通過生成按鈕的javascript中的ajax將其提供給PayPal按鈕。 我還必須深入研究他們和PayPal的文檔,並弄清楚如何使這項工作,因為它最初並不是非常清楚。 無論如何,一旦我完成了Set服務,我就會收集來自CyberSource的回復中的信息以及PayPal令牌,並將其發送到Get Details服務電話(也稱為CyberSource)。 最后,該信息被提供給Do Sale和Do Capture服務電話,並且資金被捕獲。 該按鈕僅允許用戶登錄其PayPal帳戶並驗證他們是否希望繼續該交易。
關於這一點,CyberSource的文檔有點缺乏清晰度,它們鏈接到一組已棄用的PayPal文檔,這並沒有使任何事情變得更容易。
由於錯誤顯示您有git無效數據,請檢查無效字段的回復字段invalidField_0到invalidField_N 。
我希望這些申請授權服務的樣本會有所幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.