API used: POST /v1/payments/payouts
Load SDK configuration for the resource. This intialization code can be done as Init Servlet.
Sample showing how to create a Single Payout with Synchronous Mode.
A resource representing a payout
You can prevent duplicate batches from being processed. If you
specify a sender_batch_id
that was used in the last 30 days, the
batch will not be processed. For items, you can specify a
sender_item_id
. If the value for the sender_item_id
is a
duplicate of a payout item that was processed in the last 30 days,
the item will not be processed.
Please note that if you are using single payout with sync mode, you can only pass one Item in the request
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 Single Payout
You can make payouts to multiple PayPal accounts or to a single PayPal account. If you are submitting a single payout, you can make a synchronous payout call, which immediately returns the results of the payout. In a synchronous payout call, the response is similar to a batch payout status response. To make a synchronous payout, specify sync_mode=true in the URL: /v1/payments/payouts?sync_mode=true