首页 文章

我如何获得Paypal适应性支付薪酬响应

提问于
浏览
1

我想为我的 Spring 季网络应用程序实现paypal自适应支付 . 我参考以下链接并实施流程https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/gs_AdaptivePayments/

我已按照以下步骤操作,步骤1:使用沙盒API凭据获取Paykey

public class AdaptiveinstantPay {

/**
 * @param args
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    Document doc = Jsoup.connect("https://svcs.sandbox.paypal.com/AdaptivePayments/Pay")
              .header("X-PAYPAL-SECURITY-USERID", "xxxxxx_api1.comforters-it.com")
              .header("X-PAYPAL-SECURITY-PASSWORD", "xxxxxxxxxx")
               .header("X-PAYPAL-SECURITY-SIGNATURE", "AiPC9BjkCyDFQXbSkoZcgqH3hpacATgu-TD5fG94GO04KCRlPl1d4hW4")
                  .header("X-PAYPAL-REQUEST-DATA-FORMAT", "NV")
                    .header("X-PAYPAL-RESPONSE-DATA-FORMAT", "NV")
                     .header("X-PAYPAL-APPLICATION-ID", "APP-80W284485P519543T")                        
                       .data("actionType", "PAY")
                         .data("currencyCode", "EUR")
                             .data("receiverList.receiver(0).amount", "55")
                               .data("receiverList.receiver(0).email", "xxxxxx@comforters-it.com")
                              .data("returnUrl", "http://www.mytestapp.com/getPaypalResponse")                              
                              .data("cancelUrl", "http://www.mytestapp.com/cancelPaypalPayment")
                              .data("requestEnvelope", "{errorLanguage:en_US, detailLevel:ReturnAll }")
             .timeout(10 * 1000).post();

    System.out.println(doc);

}

第2步:我已经解析了Jsoup响应并获得了PayKey,之后我发送了https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=My-payKey

付款成功后,paypal重定向控制到http://www.mytestapp.com/getPaypalResponse . 但问题是我可以't get response parameters. I unable get response parameters like paykey, receiveremail, ack ect... i dont know what is my mistake. Please correct me if i'错了

谢谢SENTHIL B.

2 回答

  • 0

    this paypal link列出了您需要用于获取付款详细信息的参数 . 一旦客户在付款后返回站点,您就可以发送请求 . 交易ID,paykey或trackingid中的任何一个就足够了 . 由于付款密钥已经可以使用,您可以使用它 . github中提供了此示例代码.servlet的确切链接为thissdk .

  • 0

    您可以使用PayPal提供的自适应支付服务类 . 它被称为自适应支付SDK .

    最后你会做这样的事情:

    Properties properties = getProperties(); // see below
    PayRequest payRequest = new PayRequest();
    // <initialize payRequest> - see below
    
    AdaptivePaymentsService adaptivePaymentsService = new AdaptivePaymentsService(properties);
    PayResponse payResponse = adaptivePaymentsService.pay(payRequest);
    String payKey = payResponse.getPayKey();
    

    您要设置的属性是:

    • acct1.UserName

    • acct1.Password

    • service.RedirectURL

    • PrimaryPayPalAccount

    • ......

    PayRequest具有请求信封,动作类型(例如PAY),取消URL,返回URL,货币代码, ReceiverList 和预批准密钥 .

相关问题