java-payments-api is a simple api that uses the payment gateways rest-api transforming them into simple methods that you can use.
Be sure to check how the payment gateways you use work
<repository> <id>eternalcode-repository-releases</id> <name>EternalCode Repository</name> <url>https://repo.eternalcode.pl/releases</url> </repository>
maven { url "https://repo.eternalcode.pl/releases" }<dependency> <groupId>dev.vetther</groupId> <artifactId>java-payments-api</artifactId> <version>1.0.8</version> </dependency>
implementation "dev.vetther:java-payments-api:1.0.8"Create payment (You need to create PayPal app, check this and this tutorial)
PaypalApi paypalApi = new PaypalApi("CLIENT_ID", "CLIENT_SECRET", false); PaypalApiCreateOrder order = paypalApi.createOrder( 2.00, // amount "USD", // currency "https://github.com/Vetther/java-payments-api", // redirect after payment "https://myapp.com/notify" // webhook, POST request after payment );
PaypalApiOrderInfo orderInfo = paypalApi.getOrderInfo("ORDER_ID"); if (orderInfo.getOrder().isPaid()) { // payment was successfully authorized }