author lvairamani
Load SDK configuration for the resource. This intialization code can be done as Init Servlet.
Sample showing to create a Payment using PayPal
Retrieve the access token from OAuthTokenCredential by passing in ClientID and ClientSecret
Pass in a ApiContext
object to authenticate
the call and to send a unique request id
(that ensures idempotency). The SDK generates
a request id if you do not pass one explicitly.
Use this variant if you want to pass in a request id that is meaningful in your application, ideally a order id. String requestId = Long.toString(System.nanoTime(); APIContext apiContext = new APIContext(accessToken, requestId ));
Let's you specify details of a payment amount.
Let's you specify a payment amount.
Total must be equal to sum of shipping, tax and subtotal.
A transaction defines the contract of a
payment - what is the payment for and who
is fulfilling it. Transaction is created with
a Payee
and Amount
types
The Payment creation API requires a list of
Transaction; add the created Transaction
to a List
A resource representing a Payer that funds a payment Payment Method as 'paypal'
A Payment Resource; create one using the above types and intent as 'sale'
Create a payment by posting to the APIService using a valid AccessToken The return object contains the status;
Create Payment Using PayPal Sample
This sample code demonstrates how you can process a PayPal Account based Payment. API used: /v1/payments/payment