Paypal 沙箱端点 Web 服务 - 错误“您无权进行此 API 调用”

发布于 2024-12-26 10:28:14 字数 4906 浏览 1 评论 0原文

我为我的 PHP5 SoapClient 使用了这个 paypal 端点 Web 服务:

Sandbox API Signature   SOAP    https://api-3t.sandbox.paypal.com/2.0/

当我使用我的凭据发送肥皂请求时,我收到错误:

  • Ack =>失败
  • 错误代码=> 10002
  • 短信=>身份验证/授权失败
  • 长消息 =>您没有权限进行此 API 调用

这是当前发送到 SOAP Paypal API 的 Soap 消息:

<?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="ebl:SetExpressCheckoutRequestDetails" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns3="urn:ebay:api:PayPalAPI" 
xmlns:ns4="ebl:UserIdPasswordType">

<SOAP-ENV:Header>
<ns3:RequesterCredentials xsi:type="ns4:UserIdPasswordType">
        <Username>xxxxx</Username>
        <Password>xxxxx</Password>
        <Signature>xxxxx</Signature>
    </ns3:RequesterCredentials>
</SOAP-ENV:Header>

<SOAP-ENV:Body>
<ns3:SetExpressCheckoutReq>
    <ns3:SetExpressCheckoutRequest>

      <ns1:Version>84.0</ns1:Version>

              <ns1:SetExpressCheckoutRequestDetails 
               xsi:type="ns2:SetExpressCheckoutRequestDetailsType">

               <ReturnUrl>url_to_/success.paypal.php</ReturnUrl>
               <CancelUrl>url_to_/cancel.paypal.php</CancelUrl>
               <LocaleCode>US</LocaleCode>

              </ns1:SetExpressCheckoutRequestDetails>

    </ns3:SetExpressCheckoutRequest>
    </ns3:SetExpressCheckoutReq>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

我实例化了此 PHP5 SoapClient:

//Endpoint
$location = 'https://api-3t.sandbox.paypal.com/2.0/';
$uri = 'urn:ebay:api:PayPalAPI';

//SoapClient options
$options = array('trace' => 1, 'exceptions' => 1, 'location'=>$location, 'uri'=>$uri);

//My Soap Client
$client =new SoapClient('https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl',$options);

但是当我调用 SetExpressCheckout Paypal Soap 服务时,我收到以下肥皂消息:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:cc="urn:ebay:apis:CoreComponentTypes" 
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" 
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" 
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" 
xmlns:ed="urn:ebay:apis:EnhancedDataTypes" 
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" 
xmlns:ns="urn:ebay:api:PayPalAPI">

<SOAP-ENV:Header>
    <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"
                      xsi:type="wsse:SecurityType"></Security>

    <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI"
                                  xsi:type="ebl:CustomSecurityHeaderType">

        <Credentials xmlns="urn:ebay:apis:eBLBaseComponents"
                                 xsi:type="ebl:UserIdPasswordType">
                    </Credentials>
    </RequesterCredentials>

</SOAP-ENV:Header>

<SOAP-ENV:Body id="_0">

    <SetExpressCheckoutResponse xmlns="urn:ebay:api:PayPalAPI">

       <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">
               2012-01-13T12:09:01Z
           </Timestamp>

    <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
    <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">
                c8d551f118a1
            </CorrelationID>

    <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">

           <ShortMessage xsi:type="xs:string">
                           Authentication/Authorization Failed
                   </ShortMessage>

           <LongMessage xsi:type="xs:string">
                        You do not have permissions to make this API call
                   </LongMessage>

            <ErrorCode xsi:type="xs:token">10002</ErrorCode>
            <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">
                          Error
                        </SeverityCode>
        </Errors>

        <Version xmlns="urn:ebay:apis:eBLBaseComponents">84.0</Version>
        <Build xmlns="urn:ebay:apis:eBLBaseComponents">2271164</Build>

    </SetExpressCheckoutResponse>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

尽管如此,我还是使用了 API 凭据我的企业帐户测试... 我不明白为什么我的代码不起作用。

错误是:“您没有权限进行此 API 调用”,但这怎么可能呢?因为我使用正确的端点服务(沙箱)?

I used this paypal endpoint webservice for my PHP5 SoapClient :

Sandbox API Signature   SOAP    https://api-3t.sandbox.paypal.com/2.0/

And when i send my soap request with my credentials, i get an error with :

  • Ack => failure
  • ErrorCode => 10002
  • Short message => Authentication/Authorization failed
  • Long message => You do not have permissions to make this API call

This is current Soap message send to soap paypal API :

<?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="ebl:SetExpressCheckoutRequestDetails" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns3="urn:ebay:api:PayPalAPI" 
xmlns:ns4="ebl:UserIdPasswordType">

<SOAP-ENV:Header>
<ns3:RequesterCredentials xsi:type="ns4:UserIdPasswordType">
        <Username>xxxxx</Username>
        <Password>xxxxx</Password>
        <Signature>xxxxx</Signature>
    </ns3:RequesterCredentials>
</SOAP-ENV:Header>

<SOAP-ENV:Body>
<ns3:SetExpressCheckoutReq>
    <ns3:SetExpressCheckoutRequest>

      <ns1:Version>84.0</ns1:Version>

              <ns1:SetExpressCheckoutRequestDetails 
               xsi:type="ns2:SetExpressCheckoutRequestDetailsType">

               <ReturnUrl>url_to_/success.paypal.php</ReturnUrl>
               <CancelUrl>url_to_/cancel.paypal.php</CancelUrl>
               <LocaleCode>US</LocaleCode>

              </ns1:SetExpressCheckoutRequestDetails>

    </ns3:SetExpressCheckoutRequest>
    </ns3:SetExpressCheckoutReq>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

I instantiated this PHP5 SoapClient :

//Endpoint
$location = 'https://api-3t.sandbox.paypal.com/2.0/';
$uri = 'urn:ebay:api:PayPalAPI';

//SoapClient options
$options = array('trace' => 1, 'exceptions' => 1, 'location'=>$location, 'uri'=>$uri);

//My Soap Client
$client =new SoapClient('https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl',$options);

But when I called SetExpressCheckout paypal soap service, i receive the following soap message :

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:cc="urn:ebay:apis:CoreComponentTypes" 
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" 
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" 
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" 
xmlns:ed="urn:ebay:apis:EnhancedDataTypes" 
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" 
xmlns:ns="urn:ebay:api:PayPalAPI">

<SOAP-ENV:Header>
    <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"
                      xsi:type="wsse:SecurityType"></Security>

    <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI"
                                  xsi:type="ebl:CustomSecurityHeaderType">

        <Credentials xmlns="urn:ebay:apis:eBLBaseComponents"
                                 xsi:type="ebl:UserIdPasswordType">
                    </Credentials>
    </RequesterCredentials>

</SOAP-ENV:Header>

<SOAP-ENV:Body id="_0">

    <SetExpressCheckoutResponse xmlns="urn:ebay:api:PayPalAPI">

       <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">
               2012-01-13T12:09:01Z
           </Timestamp>

    <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack>
    <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">
                c8d551f118a1
            </CorrelationID>

    <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">

           <ShortMessage xsi:type="xs:string">
                           Authentication/Authorization Failed
                   </ShortMessage>

           <LongMessage xsi:type="xs:string">
                        You do not have permissions to make this API call
                   </LongMessage>

            <ErrorCode xsi:type="xs:token">10002</ErrorCode>
            <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">
                          Error
                        </SeverityCode>
        </Errors>

        <Version xmlns="urn:ebay:apis:eBLBaseComponents">84.0</Version>
        <Build xmlns="urn:ebay:apis:eBLBaseComponents">2271164</Build>

    </SetExpressCheckoutResponse>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Nevertheless, I used the API credentials of my business account test...
I don't understand why my code doesnt work.

The error is : 'You do not have permissions to make this API call', but how it's possible? Because i use the correct endpoint service (sandbox) ?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文