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 This is how our body should look like: { "sender_batch_header": { "sender_batch_id": "random_uniq_id", "email_subject": "You have a payment" }, "items": [ { "recipient_type": "EMAIL", "amount": { "value": 0.99, "currency": "USD" }, "receiver": "shirt-supplier-one@mail.com", "note": "Thank you.", "sender_item_id": "item_1" }, { "recipient_type": "EMAIL", "amount": { "value": 0.90, "currency": "USD" }, "receiver": "shirt-supplier-two@mail.com", "note": "Thank you.", "sender_item_id": "item_2" }, { "recipient_type": "EMAIL", "amount": { "value": 2.00, "currency": "USD" }, "receiver": "shirt-supplier-three@mail.com", "note": "Thank you.", "sender_item_id": "item_3" } ] }
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
Please note that if you are using single payout with sync mode, you can only pass one Item in the request
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 Batch Payout
The asynchronous payout mode (sync_mode=false, which is the default) enables a maximum of 500 individual payouts to be specified in one API call. Exceeding 500 payouts in one call returns an HTTP response message with status code 400 (Bad Request).