Load SDK configuration for the resource. This intialization code can be done as Init Servlet.
Sample showing how to get a Payout Batch Status
We are re-using the CreateBatchPayoutServlet to create a batch payout for us. This will make sure the samples will work all the time.
Let's update the payment amount as an example.
Total must be equal to sum of shipping, tax and subtotal.
Create a patch object, and fill these 3 properties accordingly.
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
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 ));
Create a payment by posting to the APIService using a valid AccessToken The return object contains the status;
Get Payout Batch Status
This call can be used to periodically to get the latest status of a batch, along with the transaction status and other data for individual items. API used: GET /v1/payments/payouts/