https://developer.paypal.com/docs/api/orders/v2/
Auth
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "AZLBDto98XnkWuOsGr78XH78ohzsHneaQY9vzVdWu9w5xSKRhv1HQl2KSCBvtIDoEEQpXzLcCvJ8d9BG:EN-cucIq8ETHYA_bFHqVPi2BJ8DhwFQGledPVS370xSucGJi9d64dvozQeQosj6uO8Q6gu6yDwmHvnnt" \
-d "grant_type=client_credentials"
/v2/checkout/orders/{id}
curl -v -X GET https://api.sandbox.paypal.com/v2/checkout/orders/2CV55440UT6646827 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer A21AAGUUf6LqvINaewYHPuyS6QQDW_TMymq1uvqmpwULHQugNg-SdoEQuPXq5JOzhXu9XRliCzpwfFeEyilAgdPNmHjYf6sWA"
API
http GET http://localhost:8080/v1/order/2CV55440UT6646827
HTTP/1.1 200 OK
Content-Length: 893
Content-Type: application/json
{
"id": "2CV55440UT6646827",
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "1.00"
},
"description": "titsonfire.store Payment for order #401 ",
"payments": {
"captures": [
{
"amount": {
"currency_code": "USD",
"value": "1.00"
},
"final_capture": true,
"id": "85W962518S850170V",
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/payments/captures/85W962518S850170V",
"method": "GET",
"rel": "self"
},
{
"href": "https://api.sandbox.paypal.com/v2/payments/captures/85W962518S850170V/refund",
"method": "POST",
"rel": "refund"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/2CV55440UT6646827",
"method": "GET",
"rel": "up"
}
],
"seller_receivable_breakdown": {
"gross_amount": {
"currency_code": "USD",
"value": "1.00"
},
"net_amount": {
"currency_code": "USD",
"value": "0.66"
},
"paypal_fee": {
"currency_code": "USD",
"value": "0.34"
}
},
"status": "COMPLETED"
}
]
},
"reference_id": "default"
}
],
"status": "COMPLETED"
}
PayPal API
curl -v -X POST https://api.sandbox.paypal.com/v2/payments/captures/85W962518S850170V/refund \
-H "Content-Type: application/json" \
-H "Authorization: Bearer A21AAF3-kYOoet64Ya_-HvqwUHgLOmK7yytpeKW2OJO82GPJtoBWfSRbEafTA9lkxxQKz6BeOopGIt13eAWTUhv1MQrdGEF7A"
API
http POST http://localhost:8080/capture/refund/4CE915409W2428342
HTTP/1.1 200 OK
Content-Length: 47
Content-Type: application/json
{
"id": "4BH36132M15490109",
"status": "COMPLETED"
}
This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
You can run your application in dev mode that enables live coding using:
./mvnw quarkus:dev
The application can be packaged using ./mvnw package
.
It produces the paypal-rest-api-1.0.0-runner.jar
file in the /target
directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/lib
directory.
The application is now runnable using java -jar target/paypal-rest-api-1.0.0-runner.jar
.
You can create a native executable using: ./mvnw package -Pnative
.
Or, if you don't have GraalVM installed, you can run the native executable build in a container using: ./mvnw package -Pnative -Dquarkus.native.container-build=true
.
You can then execute your native executable with: ./target/paypal-rest-api-1.0.0-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/building-native-image.