masasdani / paypal-springboot Goto Github PK
View Code? Open in Web Editor NEWpaypal payment sample using spring boot, paypal java SDK, thymeleaf
paypal payment sample using spring boot, paypal java SDK, thymeleaf
Hello,
There is a paypal bug when you pay more than 2 times because of the request id, the error message is :
"2019-01-22 15:33:19.143 ERROR 5416 --- [nio-8082-exec-7] com.paypal.base.HttpConnection : Error code : 400 with response : {"name":"DUPLICATE_REQUEST_ID","message":"The value of PayPal-Request-Id header has already been used","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"f3a9504624464"}"
But i have found a solution !
You need to add this line "apiContext.setMaskRequestId(true);" in the createPayement method located in the PaypalService class juste before the return statement
To be sure you understand :
public Payment createPayment(
Double total,
String currency,
PaypalPaymentMethod method,
PaypalPaymentIntent intent,
String description,
String cancelUrl,
String successUrl) throws PayPalRESTException{
Amount amount = new Amount();
amount.setCurrency(currency);
....
RedirectUrls redirectUrls = new RedirectUrls();
redirectUrls.setCancelUrl(cancelUrl);
redirectUrls.setReturnUrl(successUrl);
payment.setRedirectUrls(redirectUrls);
//Add the line below
apiContext.setMaskRequestId(true);
return payment.create(apiContext);
}
I don't know why this is working but since i have put the line i'm able to pay more than 2 times !
Again thank you for this repository and have a nice day.
hi when i tried to run the projet i've had the following exception:
2018-05-01 14:41:48.477 ERROR 5264 --- [nio-8083-exec-2] com.paypal.base.HttpConnection : Error code : 400 with response : {"name":"VALIDATION_ERROR","details":[{"field":"transactions.amount","issue":"Currency amount must be non-negative number, may optionally contain exactly 2 decimal places separated by '.', optional thousands separator ',', limited to 7 digits before the decimal point and currency which is a valid ISO Currency Code"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"c90e93717f741"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.