使用 SOAP 的 PayPal API

发布于 2024-12-10 21:41:21 字数 1354 浏览 4 评论 0原文

我需要使用 PayPal API,使用 SOAP 来获取 PayPal 余额。

我已经使用此 XML 发出请求:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Header>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
<Username>[xxxxx]</Username>
<Password>[xxxxx]</Password>
<Signature>[xxxxx]</Signature>
<Subject>
</Subject>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<GetBalanceReq xsi:type="GetBalanceRequest">
<GetBalanceRequest xsi:type="GetBalanceRequestType">
<Version>83.0</Version>
<ReturnAllCurrencies>0</ReturnAllCurrencies>
</GetBalanceRequest>
</GetBalanceReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

...但我得到了以下响应:

SOAP-ENV:ClientMethod“GetBalanceReq”未实现

我的 XML 看起来没问题吗?

I need to use the PayPal API, using SOAP, to get our PayPal balance.

I've got as far as making a request using this XML:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Header>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
<Username>[xxxxx]</Username>
<Password>[xxxxx]</Password>
<Signature>[xxxxx]</Signature>
<Subject>
</Subject>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<GetBalanceReq xsi:type="GetBalanceRequest">
<GetBalanceRequest xsi:type="GetBalanceRequestType">
<Version>83.0</Version>
<ReturnAllCurrencies>0</ReturnAllCurrencies>
</GetBalanceRequest>
</GetBalanceReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

...but I'm getting this response:

SOAP-ENV:ClientMethod 'GetBalanceReq' not implemented

Does my XML look ok..?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稚然 2024-12-17 21:41:21

您可以省略“凭据”标题中的可选部分。也许您没有选择正确的端点(似乎 getBalance 不可用)。以下 SOAP 请求适用于 最新沙箱 WSDL

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ebay:api:PayPalAPI" xmlns:urn1="urn:ebay:apis:eBLBaseComponents">
   <soapenv:Header>
      <urn:RequesterCredentials>
           <urn1:Credentials>
            <urn1:Username>xxxx</urn1:Username>
            <urn1:Password>xxxx</urn1:Password>
            <urn1:Signature>xxxx</urn1:Signature>
         </urn1:Credentials>
      </urn:RequesterCredentials>
   </soapenv:Header>
   <soapenv:Body>
      <urn:GetBalanceReq>
         <urn:GetBalanceRequest>
            <urn1:Version>83.0</urn1:Version>
            <urn:ReturnAllCurrencies>0</urn:ReturnAllCurrencies>
         </urn:GetBalanceRequest>
      </urn:GetBalanceReq>
   </soapenv:Body>
</soapenv:Envelope>

以及响应:

<SOAP-ENV:Envelope "...">
   <SOAP-ENV:Header>
    "..."
   </SOAP-ENV:Header>
   <SOAP-ENV:Body id="_0">
      <GetBalanceResponse xmlns="urn:ebay:api:PayPalAPI">
         <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2011-10-20T17:27:54Z</Timestamp>
         <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
         <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">e6bb1ac6861d7</CorrelationID>
         <Version xmlns="urn:ebay:apis:eBLBaseComponents">83.0</Version>
         <Build xmlns="urn:ebay:apis:eBLBaseComponents">2183220</Build>
         <Balance xsi:type="cc:BasicAmountType" currencyID="USD">0.00</Balance>
         <BalanceTimeStamp xsi:type="xs:dateTime">2011-10-20T17:27:54Z</BalanceTimeStamp>
      </GetBalanceResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You can omit the optional parts in the "Credentials" header. Maybe you did not select the right endpoint (it seems getBalance is not available). The following SOAP request works with the latest sandbox WSDL :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ebay:api:PayPalAPI" xmlns:urn1="urn:ebay:apis:eBLBaseComponents">
   <soapenv:Header>
      <urn:RequesterCredentials>
           <urn1:Credentials>
            <urn1:Username>xxxx</urn1:Username>
            <urn1:Password>xxxx</urn1:Password>
            <urn1:Signature>xxxx</urn1:Signature>
         </urn1:Credentials>
      </urn:RequesterCredentials>
   </soapenv:Header>
   <soapenv:Body>
      <urn:GetBalanceReq>
         <urn:GetBalanceRequest>
            <urn1:Version>83.0</urn1:Version>
            <urn:ReturnAllCurrencies>0</urn:ReturnAllCurrencies>
         </urn:GetBalanceRequest>
      </urn:GetBalanceReq>
   </soapenv:Body>
</soapenv:Envelope>

And the response:

<SOAP-ENV:Envelope "...">
   <SOAP-ENV:Header>
    "..."
   </SOAP-ENV:Header>
   <SOAP-ENV:Body id="_0">
      <GetBalanceResponse xmlns="urn:ebay:api:PayPalAPI">
         <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2011-10-20T17:27:54Z</Timestamp>
         <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
         <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">e6bb1ac6861d7</CorrelationID>
         <Version xmlns="urn:ebay:apis:eBLBaseComponents">83.0</Version>
         <Build xmlns="urn:ebay:apis:eBLBaseComponents">2183220</Build>
         <Balance xsi:type="cc:BasicAmountType" currencyID="USD">0.00</Balance>
         <BalanceTimeStamp xsi:type="xs:dateTime">2011-10-20T17:27:54Z</BalanceTimeStamp>
      </GetBalanceResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文