2013-11-15 1 views
0

간단한 질문 만하고 싶습니다. 고객이 PayPal Advance 지불 계좌를 구입했습니다. PayPal Advance 지불 계좌에는 월간 5 달러의 추가 비용이 포함되어 있습니다.자바 개발자를위한 Paypal Advance Payment

이 계정을 사용하여 어떤 기능을 사용할 수 있습니까? Google에서 검색했지만 relavent 정보를 찾을 수 없습니다.

고객이 내 웹 사이트에서 모든 지불을해야한다고 요구하는 경우 사용자가 구매를 위해 페이팔 공식 웹 사이트로 리디렉션하지 못하게하십시오.

이 계정으로 어떻게 할 수 있습니까? 내가 사용할 수있는 기능과 서비스 또는 API는 무엇입니까?

+0

'내 고객은 내 웹 사이트에서 모든 지불을해야한다고 요구하고 사용자가 구매를 위해 페이팔 공식 웹 사이트로 리디렉션하지 못하게하십시오. ' 할 수 없습니다. 당신이 할 수있는 최선은 원활한 통합을 위해 웹 사이트 디자인을 페이팔에 제공하는 것입니다. 그러나 무엇을 하든지 고객을 페이팔로 리디렉션해야합니다. 이는 보안 제한 사항입니다. 그렇지 않으면 제 3자가 고객의 페이팔 이름과 비밀번호를 알아낼 수 있습니다. – bezmax

+0

당신의 재연에 대해 감사 드리며, PayFlow와 PayFlow Pro라는 또 다른 서비스가 있습니다. –

+0

고객이 지불하는 금액이 페이팔 계좌로 지불하고 싶다면 그는 어쨌든 페이팔로 리디렉션됩니다. payflow pro로 무엇을 할 수 있는지에 대한 정보는 https://www.paypal.com/cgi-bin/webscr?cmd=xpt/Marketing/demo/wppro/WPProDemo6-outside (이 페이지는 클라이언트가 페이팔로 리디렉션됩니다). PayFlow와 PayFlow Pro AFAIK의 차이점은 하나는 페이팔로의 간단한 리다이렉션이고, 다른 하나는 디자인을 사용하고 원활한 신용 카드 게이트웨이로 페이팔을 사용하는 것을 지원한다는 것입니다 (리다이렉션을 전혀하지 않음). – bezmax

답변

1

여기에 문제의 해결책이 있습니다. 아래의 요점을 따르십시오.

  1. 하나의 메이븐 웹 응용 프로그램을 만듭니다.
  2. 은 다음과 종속

     <dependency> 
          groupId>com.paypal.sdk</groupId> 
            <artifactId>adaptivepaymentssdk</artifactId> 
            <version>2.5.106</version> 
          </dependency> 
    

3.Here 이메일로 지불 이메일에 대한 코드의 포함하는 클래스를 포함합니다.

public class PaymentTest { 
    public static boolean fundtransferFromClientAcount() { 

     PayRequest req = new PayRequest(); 
     RequestEnvelope requestEnvelope = new RequestEnvelope(); 
     requestEnvelope.setErrorLanguage("en_US"); 
     req.setRequestEnvelope(requestEnvelope); 
     List<Receiver> receiver = new ArrayList<Receiver>(); 
     Receiver rec = new Receiver(); 
     /** (Required) Amount to be paid to the receiver */ 
     rec.setAmount(10.00); 
     /**Reciever and Sender should be register on paypal with same emailid.*/ 
     rec.setEmail("Reciever Email Id"); 
     receiver.add(rec); 
     ReceiverList receiverlst = new ReceiverList(receiver); 
     req.setReceiverList(receiverlst); 
     req.setSenderEmail("Sender Email"); 
     req.setActionType("PAY"); 
     req.setCancelUrl("Cancel Url"); 
     req.setCurrencyCode("USD"); 
     /** Here we need to give success url */ 
     req.setReturnUrl("return or success url"); 
     Map<String, String> configurationMap =Configuration.getAcctAndConfig(); 
     // Creating service wrapper object to make an API call by loading 
     // configuration map. 
     AdaptivePaymentsService service = new AdaptivePaymentsService(
       configurationMap); 
     try { 
      PayResponse resp = service.pay(req); 
      if (resp != null) { 
       if (resp.getResponseEnvelope().getAck().toString() 
         .equalsIgnoreCase("SUCCESS")) { 
        Map<Object, Object> map = new LinkedHashMap<Object, Object>(); 
        map.put("Ack", resp.getResponseEnvelope().getAck()); 

        /** 
        * Correlation identifier. It is a 13-character, 
        * alphanumeric string (for example, db87c705a910e) that is 
        * used only by PayPal Merchant Technical Support. Note: You 
        * must log and store this data for every response you 
        * receive. PayPal Technical Support uses the information to 
        * assist with reported issues. 
        */ 
        map.put("CorrelationID", resp.getResponseEnvelope() 
          .getCorrelationId()); 

        /** 
        * Date on which the response was sent, for example: 
        * 2012-04-02T22:33:35.774-07:00 Note: You must log and 
        * store this data for every response you receive. PayPal 
        * Technical Support uses the information to assist with 
        * reported issues. 
        */ 
        map.put("TimeStamp", resp.getResponseEnvelope() 
          .getTimestamp()); 

        /** 
        * The pay key, which is a token you use in other Adaptive 
        * Payment APIs (such as the Refund Method) to identify this 
        * payment. The pay key is valid for 3 hours; the payment 
        * must be approved while the pay key is valid. 
        */ 
        map.put("PayKey", resp.getPayKey()); 

        /** 
        * The status of the payment. Possible values are: CREATED – 
        * The payment request was received; funds will be 
        * transferred once the payment is approved COMPLETED – The 
        * payment was successful INCOMPLETE – Some transfers 
        * succeeded and some failed for a parallel payment or, for 
        * a delayed chained payment, secondary receivers have not 
        * been paid ERROR – The payment failed and all attempted 
        * transfers failed or all completed transfers were 
        * successfully reversed REVERSALERROR – One or more 
        * transfers failed when attempting to reverse a payment 
        * PROCESSING – The payment is in progress PENDING – The 
        * payment is awaiting processing 
        */ 
        map.put("Payment Execution Status", 
          resp.getPaymentExecStatus()); 
        if (resp.getDefaultFundingPlan() != null) { 
         /** Default funding plan. */ 
         map.put("Default Funding Plan", resp 
           .getDefaultFundingPlan().getFundingPlanId()); 
        } 
        // Skipping for Implicit Payments 
        if (!resp.getPaymentExecStatus().equalsIgnoreCase(
          "Completed")) { 
         map.put("Redirect URL", 
           "<a href=https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=" 
             + resp.getPayKey() 
             + ">https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=" 
             + resp.getPayKey() + "</a>"); 
        } 


        for (Entry<Object, Object> entry : map.entrySet()) { 
         System.out.println("Key : " + entry.getKey() 
           + " Value : " + entry.getValue()); 
        } 
        return true; 
       } else { 
        return false; 
       } 
      } 

     } catch (Exception e) { 
      e.printStackTrace(); 
      return false; 
     } 

     return true; 
    } 

    public static void main(String[] args) { 

     fundtransferFromClientAcount(); 
    } 

} 

4.Configuration 파일

/** 
* For a full list of configuration parameters refer in wiki page(https://github.com/paypal/sdk-core-java/wiki/SDK-Configuration-Parameters). 
*/ 
public class Configuration { 

     // Creates a configuration map containing credentials and other required configuration parameters. 
     public static final Map<String,String> getAcctAndConfig(){ 
       Map<String,String> configMap = new HashMap<String,String>(); 
       configMap.putAll(getConfig()); 

       // Account Credential 
       configMap.put("acct1.UserName", "sandbox account username"); 
       configMap.put("acct1.Password", "sandbox account password"); 
       configMap.put("acct1.Signature", "sandbox account signature"); 
       configMap.put("acct1.AppId", "sandbox account generated AppId"); 

       // Sample Certificate credential 
       // configMap.put("acct2.UserName", "certuser_biz_api1.paypal.com"); 
       // configMap.put("acct2.Password", "D6JNKKULHN3G5B8A"); 
       // configMap.put("acct2.CertKey", "password"); 
       // configMap.put("acct2.CertPath", "resource/sdk-cert.p12"); 
       // configMap.put("acct2.AppId", "APP-80W284485P519543T"); 

       // Sandbox Email Address 
       configMap.put("sandbox.EmailAddress", "email address for sandbox"); 

       return configMap; 
     } 

     public static final Map<String,String> getConfig(){ 
       Map<String,String> configMap = new HashMap<String,String>(); 

       // Endpoints are varied depending on whether sandbox OR live is chosen for mode 
       configMap.put("mode", "sandbox"); 

       // These values are defaulted in SDK. If you want to override default values, uncomment it and add your value. 
       // configMap.put("http.ConnectionTimeOut", "5000"); 
       // configMap.put("http.Retry", "2"); 
       // configMap.put("http.ReadTimeOut", "30000"); 
       // configMap.put("http.MaxConnection", "100"); 
       return configMap; 
     } 
} 

5.Just 필요한 모든 매개 변수를 얻고 그것을 잘 작동합니다.