2014-04-05 4 views
0

안녕하세요, 저는 JAVA Merhant SDK를 사용하여 Paypal Recurring Pyramament를 만들려고하지만 "createRecurringPaymentsProfile"메소드를 호출 할 때 "유효하지 않은 토큰"을 계속 가지고 있습니다. 여기 java paypal merchand sdk 반복 지불 잘못된 토큰

요청 및 요청 SetExpressCheckout

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:ebay:api:PayPalAPI" 
       xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:cc="urn:ebay:apis:CoreComponentTypes" 
       xmlns:ed="urn:ebay:apis:EnhancedDataTypes"> 
<soapenv:Header> 
    <ns:RequesterCredentials> 
     <ebl:Credentials> 
      <ebl:Username>XXX</ebl:Username> 
      <ebl:Password>XXX</ebl:Password> 
      <ebl:Signature>XXX</ebl:Signature> 
     </ebl:Credentials> 
    </ns:RequesterCredentials> 
</soapenv:Header> 
<soapenv:Body> 
    <ns:SetExpressCheckoutReq> 
     <ns:SetExpressCheckoutRequest> 
      <ebl:Version>109.0</ebl:Version> 
      <ebl:SetExpressCheckoutRequestDetails> 
       <ebl:ReturnURL>http://127.0.0.1:8888/ReturnURL</ebl:ReturnURL> 
       <ebl:CancelURL>http://127.0.0.1:8888/CancelURL</ebl:CancelURL> 
       <ebl:BillingAgreementDetails> 
        <ebl:BillingType>RecurringPayments</ebl:BillingType> 
        <ebl:BillingAgreementDescription>Buyer is billed at &quot;USD1.00&quot; per month 
        </ebl:BillingAgreementDescription> 
       </ebl:BillingAgreementDetails> 
       <ebl:PaymentDetails> 
        <ebl:OrderTotal currencyID="USD">1.00</ebl:OrderTotal> 
        <ebl:ItemTotal currencyID="USD">1</ebl:ItemTotal> 
        <ebl:ButtonSource>PayPal_SDK</ebl:ButtonSource> 
        <ebl:NotifyURL>/NotifyURL</ebl:NotifyURL> 
        <ebl:PaymentAction>Sale</ebl:PaymentAction> 
       </ebl:PaymentDetails> 
      </ebl:SetExpressCheckoutRequestDetails> 
     </ns:SetExpressCheckoutRequest> 
    </ns:SetExpressCheckoutReq> 
</soapenv:Body> 

CreateRecurringPaymentsProfile 요구에 응답

<?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"> 
       <Username xsi:type="xs:string"></Username> 
       <Password xsi:type="xs:string"></Password> 
       <Signature xsi:type="xs:string"></Signature> 
       <Subject xsi:type="xs:string"></Subject> 
      </Credentials> 
     </RequesterCredentials> 
    </SOAP-ENV:Header> 
    <SOAP-ENV:Body id="_0"> 
     <SetExpressCheckoutResponse xmlns="urn:ebay:api:PayPalAPI"> 
      <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2014-04-05T22:23:40Z</Timestamp> 
      <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack> 
      <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">6c19207a14fd</CorrelationID> 
      <Version xmlns="urn:ebay:apis:eBLBaseComponents">109.0</Version> 
      <Build xmlns="urn:ebay:apis:eBLBaseComponents">10463669</Build> 
      <Token xsi:type="ebl:ExpressCheckoutTokenType">EC-1X212344K9178491M</Token> 
     </SetExpressCheckoutResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

이에 대한 응답

있다

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:ebay:api:PayPalAPI" 
        xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:cc="urn:ebay:apis:CoreComponentTypes" 
        xmlns:ed="urn:ebay:apis:EnhancedDataTypes"> 
    <soapenv:Header> 
     <ns:RequesterCredentials> 
      <ebl:Credentials> 
       <ebl:Username>XXX</ebl:Username> 
       <ebl:Password>XXX</ebl:Password> 
       <ebl:Signature>XXX</ebl:Signature> 
      </ebl:Credentials> 
     </ns:RequesterCredentials> 
    </soapenv:Header> 
    <soapenv:Body> 
     <ns:CreateRecurringPaymentsProfileReq> 
      <ns:CreateRecurringPaymentsProfileRequest> 
       <ebl:Version>109.0</ebl:Version> 
       <ebl:CreateRecurringPaymentsProfileRequestDetails> 
        <ebl:Token>EC-1X212344K9178491M</ebl:Token> 
        <ebl:RecurringPaymentsProfileDetails> 
         <ebl:BillingStartDate>2014-04-06T13:21:36Z</ebl:BillingStartDate> 
        </ebl:RecurringPaymentsProfileDetails> 
        <ebl:ScheduleDetails> 
         <ebl:Description>Buyer is billed at &quot;USD1.00&quot; per month</ebl:Description> 
         <ebl:PaymentPeriod> 
          <ebl:BillingPeriod>Month</ebl:BillingPeriod> 
          <ebl:BillingFrequency>12</ebl:BillingFrequency> 
          <ebl:Amount currencyID="USD">1.00</ebl:Amount> 
         </ebl:PaymentPeriod> 
        </ebl:ScheduleDetails> 
       </ebl:CreateRecurringPaymentsProfileRequestDetails> 
      </ns:CreateRecurringPaymentsProfileRequest> 
     </ns:CreateRecurringPaymentsProfileReq> 
    </soapenv:Body> 
</soapenv:Envelope> 

응답 17,451,515,는 "유효하지 않은 토큰"

<?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"> 
       <Username xsi:type="xs:string"></Username> 
       <Password xsi:type="xs:string"></Password> 
       <Signature xsi:type="xs:string"></Signature> 
       <Subject xsi:type="xs:string"></Subject> 
      </Credentials> 
     </RequesterCredentials> 
    </SOAP-ENV:Header> 
    <SOAP-ENV:Body id="_0"> 
     <CreateRecurringPaymentsProfileResponse xmlns="urn:ebay:api:PayPalAPI"> 
      <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2014-04-05T22:28:11Z</Timestamp> 
      <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack> 
      <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">50e773299b36f</CorrelationID> 
      <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType"> 
       <ShortMessage xsi:type="xs:string">Invalid Token</ShortMessage> 
       <LongMessage xsi:type="xs:string">The token is invalid</LongMessage> 
       <ErrorCode xsi:type="xs:token">11502</ErrorCode> 
       <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode> 
      </Errors> 
      <Version xmlns="urn:ebay:apis:eBLBaseComponents">109.0</Version> 
      <Build xmlns="urn:ebay:apis:eBLBaseComponents">10433064</Build> 
      <CreateRecurringPaymentsProfileResponseDetails xmlns="urn:ebay:apis:eBLBaseComponents" 
                  xsi:type="ebl:CreateRecurringPaymentsProfileResponseDetailsType"> 
       <ProfileID xsi:type="xs:string"></ProfileID> 
       <TransactionID xsi:type="xs:string"></TransactionID> 
      </CreateRecurringPaymentsProfileResponseDetails> 
     </CreateRecurringPaymentsProfileResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

내가 CreateRecurringPaymentsProfile 요청 토큰이 SetExpressCheckout의 응답 토큰이라고 확신했다.

답변

0

내 질문에 답변.

OrderTotal을 "0"으로 설정하고 SetExpressCheckout 요청에서 ItemTotal을 제거해야합니다.

하지만 "잘못된 토큰 오류"는별로 도움이되지 않는 오류 메시지입니다. 다음과 같은 코드를 포함 SetExpressCheckOutResponse 후

0

, 나는이 뜻은 당신이 도움이되기를 바랍니다

Map<String, String> sdkConfig = new HashMap<String, String>(); 
sdkConfig.put("mode", "sandbox"); 

sdkConfig.put("mode", "sandbox"); 
sdkConfig.put("acct1.UserName", apiUsername); 
sdkConfig.put("acct1.Password", apiPassword); 
sdkConfig.put("acct1.Signature", apiSignature); 

SimpleDateFormat formatterR = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:sssz"); 

CreateRecurringPaymentsProfileReq createRecurringPaymentsProfileReq = new CreateRecurringPaymentsProfileReq(); 
CreateRecurringPaymentsProfileRequestType createRecurringPaymentsProfileRequest = new CreateRecurringPaymentsProfileRequestType(); 

RecurringPaymentsProfileDetailsType recurringPaymentsProfileDetails = new RecurringPaymentsProfileDetailsType(); 
recurringPaymentsProfileDetails.setBillingStartDate(formatterR.format(new Date())); 
recurringPaymentsProfileDetails.setSubscriberName("YOUR SUBSCRIBER NAME"); 

BasicAmountType billingAmount = new BasicAmountType(CurrencyCodeType.USD, "1.00"); 
//I Take as MONTHLY Recurrence 
//So that i set periodType as MONTH, frequency as 1 (for every month) and billing amount here i sent as 1 USD 
BillingPeriodDetailsType paymentPeriod = new BillingPeriodDetailsType(BillingPeriodType.MONTH, Integer.parseInt("1"), billingAmount); 
ScheduleDetailsType scheduleDetails = new ScheduleDetailsType("Description about payment", paymentPeriod); //description, paymentPeriod object    
CreateRecurringPaymentsProfileRequestDetailsType createRecurringPaymentsProfileRequestDetails = new CreateRecurringPaymentsProfileRequestDetailsType(recurringPaymentsProfileDetails, scheduleDetails); 

AddressType addressType = new AddressType(); 
addressType.setStateOrProvince("STATE"); 
addressType.setCityName("CITY"); 
addressType.setCountryName("COUNTRY"); 

PersonNameType personName = new PersonNameType(); 
personName.setFirstName("SUBSCRIBER FIRST NAME"); 
personName.setLastName("SUBSCRIBER LAST NAME"); 

PayerInfoType payerInfoType = new PayerInfoType(); 
payerInfoType.setAddress(addressType); 
payerInfoType.setPayerName(personName); 

       CreditCardDetailsType creditCard = new CreditCardDetailsType(); 
       //creditCard.setCreditCardType(CreditCardTypeType.VISA); 

       // Credit Card Number 
       creditCard.setCreditCardNumber("CARD NO");//4442662639546634 

       // Credit Card Expiration Month 
       creditCard.setExpMonth(12);//Integer.parseInt("12") 

       // Credit Card Expiration Year 
       creditCard.setExpYear(Integer.parseInt(2016);//Integer.parseInt("2016") 
       creditCard.setCVV2("CVV CODE"); 
       creditCard.setCardOwner(payerInfoType); 
       createRecurringPaymentsProfileRequestDetails.setCreditCard(creditCard); 

       createRecurringPaymentsProfileRequest 
         .setCreateRecurringPaymentsProfileRequestDetails(createRecurringPaymentsProfileRequestDetails); 
       createRecurringPaymentsProfileReq 
         .setCreateRecurringPaymentsProfileRequest(createRecurringPaymentsProfileRequest); 

       PayPalAPIInterfaceServiceService service = null; 
       try { 
        service = new PayPalAPIInterfaceServiceService(sdkConfig); 
       } catch (Exception e) { 
        LOGGER.info("Error Message : " + e.getMessage()); 
       } 
       CreateRecurringPaymentsProfileResponseType createRecurringPaymentsProfileResponse = null; 
       try { 
        // ## Making API call 
        // Invoke the appropriate method corresponding to API in service 
        // wrapper object 
        createRecurringPaymentsProfileResponse = service 
          .createRecurringPaymentsProfile(createRecurringPaymentsProfileReq); 
       } catch (Exception e) { 
        LOGGER.info("Error Message : " + e.getMessage()); 
       } 

       String ProfileID = ""; 
       // ## Accessing response parameters 
       // You can access the response parameters using getter methods in 
       // response object as shown below 
       // ### Success values 
       if (createRecurringPaymentsProfileResponse.getAck().getValue() 
         .equalsIgnoreCase("success")) { 

        // A unique identifier for future reference to the details of 
        // this recurring payment. 
        ProfileID = createRecurringPaymentsProfileResponse 
          .getCreateRecurringPaymentsProfileResponseDetails() 
          .getProfileID(); 
        LOGGER.info("Profile ID:"+ProfileID); 
        //mes = "approved"; 
       } 
       // ### Error Values 
       // Access error values from error list using getter methods 
       else { 
        List<ErrorType> errorList = createRecurringPaymentsProfileResponse 
          .getErrors(); 
        LOGGER.info("API Error Message : " 
          + errorList.get(0).getLongMessage()); 
        //mes = "error"; 
       } 

...