gpt4 book ai didi

c# - PayPal DoReferenceTransaction

转载 作者:太空宇宙 更新时间:2023-11-03 13:43:24 27 4
gpt4 key购买 nike

我正在调用进程 DoReferenceTransaction (SOAP)用C#。它运行良好,数据到达并且 DoReferenceTransactionResponseType 中的结果没有错误。但是详细信息 DoReferenceTransactionResponseDetails 永远为空。

是否有任何变量可以启用以填充响应中的详细信息?我在 DoReferenceTransactionResponseDetails.Any 中找到了一个 XML 字符串,但如果它在 DoReferenceTransactionResponseDetails 中,我为什么要从 xml 中排除数据?

我必须拥有的是来自 PayPal 的 TransactionID

谢谢

请求示例:

  request = new DoReferenceTransactionReq();
request.DoReferenceTransactionRequest = new DoReferenceTransactionRequestType();
request.DoReferenceTransactionRequest.Version = "98.0";
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails = new DoReferenceTransactionRequestDetailsType();
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentAction = PaymentActionCodeType.Sale;
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentType = MerchantPullPaymentCodeType.Any;
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentDetails = new PaymentDetailsType();
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentDetails.OrderTotal = new BasicAmountType();
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentDetails.OrderTotal.Value = "100";
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentDetails.OrderTotal.currencyID = CurrencyCodeType.CHF;
request.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.ReferenceID = "XXXX";

DoReferenceTransactionResponseType response = service.DoReferenceTransaction(request);

response from the upper request

交易已成功处理,我可以在 paypal 沙箱的页面概览中看到它。

最佳答案

您应该会收到带有值的回复。它不应该为空。例如,我传递了以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:ns2="urn:ebay:api:PayPalAPI">
<SOAP-ENV:Header>
<ns2:RequesterCredentials>
<ns1:Credentials>
<ns1:Username>%Username%</ns1:Username>
<ns1:Password>%Password%</ns1:Password>
<ns1:Signature>%Signature%</ns1:Signature>
</ns1:Credentials>
</ns2:RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns2:DoReferenceTransactionReq>
<ns2:DoReferenceTransactionRequest>
<ns1:Version>84.0</ns1:Version>
<ns1:DoReferenceTransactionRequestDetails>
<ns1:ReferenceID>1A381834JN903220E</ns1:ReferenceID>
<ns1:PaymentAction>Sale</ns1:PaymentAction>
<ns1:PaymentType>Any</ns1:PaymentType>
<ns1:PaymentDetails>
<ns1:OrderTotal currencyID="USD">10.00</ns1:OrderTotal>
<ns1:PaymentAction>Sale</ns1:PaymentAction>
</ns1:PaymentDetails>
<ns1:IPAddress>10.243.180.150</ns1:IPAddress>
</ns1:DoReferenceTransactionRequestDetails>
</ns2:DoReferenceTransactionRequest>
</ns2:DoReferenceTransactionReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我在 API 响应中得到以下信息:

Array
(
[name] => DoReferenceTransactionResponse
[elements] => Array
(
[0] => Array
(
[name] => Timestamp
[text] => 2013-04-25T13:22:14Z
)

[1] => Array
(
[name] => Ack
[text] => Success
)

[2] => Array
(
[name] => CorrelationID
[text] => 748fcba0bc2e7
)

[3] => Array
(
[name] => Version
[text] => 84.0
)

[4] => Array
(
[name] => Build
[text] => 5650305
)

[5] => Array
(
[name] => DoReferenceTransactionResponseDetails
[elements] => Array
(
[0] => Array
(
[name] => Amount
[text] => 10.00
)

[1] => Array
(
[name] => AVSCode
[text] => X
)

[2] => Array
(
[name] => CVV2Code
[text] => M
)

[3] => Array
(
[name] => TransactionID
[text] => 2PR97363S20425407
)

)

)

)

)

关于c# - PayPal DoReferenceTransaction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16215010/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com