提交 b371a1b1 authored 作者: zgy's avatar zgy

paypal支付

上级 6e13ef4e
......@@ -42,21 +42,25 @@ public class PayPalController {
@RequestMapping("/testPay")
public Result testPay(){
PayPalConfigStorage storage = new PayPalConfigStorage();
storage.setClientID("AWbyqn1AKJeVvzNsYms_9fs_LVr5_w5Xyt8nX5q0Wmqoq0NYCZf2wyz9DDeA5ArsWx0LFBwl5Oz6amD2");
storage.setClientSecret("EFhRjCBzhtI1lf88Xiy3VF07gVpu1vWk0VheSP3n5J0fhQxA6Pu7j89dbyYTLj3FxqiJBOlxQRKG_58e");
//storage.setTest(true);
//发起付款后的页面转跳地址
storage.setReturnUrl("http://127.0.0.1:8083/pay/success");
//取消按钮转跳地址,这里用异步通知地址的兼容的做法
storage.setNotifyUrl("http://127.0.0.1:8083/pay/cancel");
HttpConfigStorage httpConfigStorage = new HttpConfigStorage();
PayService service = new PayPalPayService(storage);
BigDecimal price = new BigDecimal("500");
PayOrder order = new PayOrder("Order_payment:", "Order payment", price, UUID.randomUUID().toString().replace("-", ""), PayPalTransactionType.sale);
Map orderInfo = service.orderInfo(order);
service.buildRequest(orderInfo, MethodType.POST);
try{
PayPalConfigStorage storage = new PayPalConfigStorage();
storage.setClientID("AWbyqn1AKJeVvzNsYms_9fs_LVr5_w5Xyt8nX5q0Wmqoq0NYCZf2wyz9DDeA5ArsWx0LFBwl5Oz6amD2");
storage.setClientSecret("EFhRjCBzhtI1lf88Xiy3VF07gVpu1vWk0VheSP3n5J0fhQxA6Pu7j89dbyYTLj3FxqiJBOlxQRKG_58e");
//storage.setTest(true);
//发起付款后的页面转跳地址
storage.setReturnUrl("http://127.0.0.1:8083/pay/success");
//取消按钮转跳地址,这里用异步通知地址的兼容的做法
storage.setNotifyUrl("http://127.0.0.1:8083/pay/cancel");
HttpConfigStorage httpConfigStorage = new HttpConfigStorage();
PayService service = new PayPalPayService(storage);
BigDecimal price = new BigDecimal("500");
PayOrder order = new PayOrder("Order_payment:", "Order payment", price, UUID.randomUUID().toString().replace("-", ""), PayPalTransactionType.sale);
Map orderInfo = service.orderInfo(order);
service.buildRequest(orderInfo, MethodType.POST);
}catch (Exception e){
return new Result().setMessage(e.getMessage());
}
return new Result().setMessage("付款成功!");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论