author lvairamani
Load SDK configuration for the resource. This intialization code can be done as Init Servlet.
Sample showing to create a Payment using Saved CreditCard as a FundingInstrument
A resource representing a credit card that can be used to fund a payment.
Let's you specify details of a payment amount.
Let's you specify a payment amount.
Total must be equal to the 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 Payeer's funding instrument. In this case, a Saved Credit Card can be passed to charge the payment.
The Payment creation API requires a list of
FundingInstrument; add the created FundingInstrument
to a List
A resource representing a Payer that funds a payment
Use the List of FundingInstrument
and the Payment Method
as 'credit_card'
A Payment Resource; create one using the above types and intent as 'sale'
Retrieve the access token from OAuthTokenCredential by passing in ClientID and ClientSecret It is not mandatory to generate Access Token on a per call basis. Typically the access token can be generated once and reused within the expiry window
APIContext which takes 'Access Token' argument
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 ));
Create a payment by posting to the APIService using a valid AccessToken The return object contains the status;
CreatePayment Using Saved Card Sample
This sample code demonstrates how you can process a Payment using a previously saved credit card. API used: /v1/payments/payment