我想为我的 spring web 应用程序实现 paypal 自适应支付。我参考以下链接并实施流程https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/gs_AdaptivePayments/
我已按照以下步骤操作,第 1 步:使用沙盒 API 凭据获取 Paykey
公共类 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。但问题是我无法获得响应参数。我无法获得响应参数,如 paykey、receiveremail、ack 等……我不知道我的错误是什么。如果我错了请纠正我
谢谢森蒂尔 B