PayPal CreateRecurringPaymentsProfile无效令牌

时间:2014-11-04 14:14:20

标签: paypal recurring-billing

我尝试使用SOAP API创建定期付款,我按照PayPal API手册中的说明执行了以下步骤:

1-致电"设置快速结账" API。 2-获取令牌并将买家重定向到PayPal站点。 3-用户完成后,他将重定向到我的回复页面。 4-打电话"表达结账" API。 5- Call" CreateRecurringPaymentsProfile" API。

我的调用SOAP结构:



<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>'+un+'</urn1:Username>
        <urn1:Password>'+pw+'</urn1:Password>
        <urn1:Signature>'+sig+'</urn1:Signature>
      </urn1:Credentials>
    </urn:RequesterCredentials>
  </soapenv:Header>
  <soapenv:Body>
    <urn:CreateRecurringPaymentsProfileReq>
      <urn:CreateRecurringPaymentsProfileRequest>
        <urn1:Version>'+version+'</urn1:Version>
        <urn1:CreateRecurringPaymentsProfileRequestDetails>
          <urn1:Token>'+token+'</urn1:Token>
          <urn1:RecurringPaymentsProfileDetails>
            <urn1:SubscriberName>'+FirstName+' '+LastName+'</urn1:SubscriberName>
            <urn1:BillingStartDate>'+strCurrentDate+'</urn1:BillingStartDate>
          </urn1:RecurringPaymentsProfileDetails>
          <urn1:ScheduleDetails>
            <urn1:Description>'+BillingAgreementDescription+'</urn1:Description>
            <urn1:PaymentPeriod>
              <urn1:BillingPeriod>'+billingPeriod+'</urn1:BillingPeriod>
              <urn1:BillingFrequency>'+billingFrequency+'</urn1:BillingFrequency>
              <urn1:Amount currencyID="'+UsedCurrency+'">'+amount+'</urn1:Amount>
            </urn1:PaymentPeriod>
          </urn1:ScheduleDetails>
        </urn1:CreateRecurringPaymentsProfileRequestDetails>
      </urn:CreateRecurringPaymentsProfileRequest>
    </urn:CreateRecurringPaymentsProfileReq>
  </soapenv:Body>
</soapenv:Envelope>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

通常情况发生在人们身上时,因为您没有在SetExpressCheckout请求中包含结算协议参数。因此,您获取的令牌确实无效,无法与CreateRecurringPaymentsProfile一起使用。

这是一个old sample set of calls我为了这个问题而回答这个问题。它使用NVP而不是SOAP,但您可以看到它在SEC请求中包含BILLINGTYPE和BILLINGAGREEMENTDESCRIPTION参数。确保您相应地包括SEC请求中的那些。

答案 1 :(得分:0)

SOAP主体结构的问题应该是:

  string doExpressCheckout = '';
    doExpressCheckout += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ebay:api:PayPalAPI" xmlns:urn1="urn:ebay:apis:eBLBaseComponents">';
    doExpressCheckout += '<soapenv:Header>';
    doExpressCheckout += '<urn:RequesterCredentials>';
    doExpressCheckout += '<urn1:Credentials>';
    doExpressCheckout += '<urn1:Username>'+un+'</urn1:Username>';
    doExpressCheckout += '<urn1:Password>'+pw+'</urn1:Password>';
    doExpressCheckout += '<urn1:Signature>'+sig+'</urn1:Signature>';
    doExpressCheckout += '</urn1:Credentials>';
    doExpressCheckout += '</urn:RequesterCredentials>';
    doExpressCheckout += '</soapenv:Header>';
    doExpressCheckout += '<soapenv:Body>';
    doExpressCheckout += '<urn:DoExpressCheckoutPaymentReq>';
    doExpressCheckout += '<urn:DoExpressCheckoutPaymentRequest>';
    doExpressCheckout += '<urn1:Version>'+version+'</urn1:Version>';
    doExpressCheckout += '<urn1:DoExpressCheckoutPaymentRequestDetails>';
    doExpressCheckout += '<urn1:Token>'+token+'</urn1:Token>';
    doExpressCheckout += '<urn1:PayerID>'+payerID+'</urn1:PayerID>';
    doExpressCheckout += '<urn1:PaymentDetails>';
    doExpressCheckout += '<urn1:OrderTotal currencyID="'+UsedCurrency+'">'+amount+'</urn1:OrderTotal>';
    doExpressCheckout += '</urn1:PaymentDetails>';
    doExpressCheckout += '</urn1:DoExpressCheckoutPaymentRequestDetails>';
    doExpressCheckout += '</urn:DoExpressCheckoutPaymentRequest>';
    doExpressCheckout += '</urn:DoExpressCheckoutPaymentReq>';
    doExpressCheckout += '</soapenv:Body>';
    doExpressCheckout += '</soapenv:Envelope>';