Skip to main content

Payouts SDK and APIs reference

You have two options to integrate PayPal Payouts to your app:

  • Use the Payouts SDK if you want a streamlined integration with built-in authentication, error handling, and support for Java, PHP, Python, or .NET.
  • Use the Payouts APIs directly if:
    • You want more control over the API calls.
    • You need to customize your integration.
    • You use a language not supported by the SDK.

Both options use the PayPal Payouts REST APIs.

Use Payouts SDK

You can use the PayPal Payouts SDK for Java, PHP, Python, or .NET to work with the Payouts REST API. The SDK helps keep your integration up to date with API changes and is intended for server-side use only.

With the SDK, you can:

  • Handle OAuth 2.0 authentication automatically.
  • Call Payouts APIs with less code.
  • Manage API responses and errors.

Install SDK

Install the Payouts SDK for your language:

// Create a Java Maven or Gradle project in your directory, then add the following dependency to the project from Maven Central.
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>payouts-sdk</artifactId>
<version>1.0.2</version>
</dependency>

Set up your environment and credentials

  1. Create a new file in your preferred language in the directory where you installed the SDK.
  2. Copy the following code sample for your language to initialize the SDK and configure your environment.
  3. Update the code with your PayPal client ID and secret.
  4. Set the environment to SandboxEnvironment for testing or LiveEnvironment for production.
import com.paypal.core.PayPalEnvironment;
import com.paypal.core.PayPalHttpClient;

PayPalEnvironment environment = new PayPalEnvironment.Sandbox(
"CLIENT_ID",
"CLIENT_SECRET"
);
PayPalHttpClient client = new PayPalHttpClient(environment);

Note: For more information on finding your REST API credentials for both sandbox and live environments, see Sandbox accounts.

Send and manage payouts

Use the SDK to create and manage payout batches.

// Create a new payout request and set the batch and item details
PayoutsPostRequest request = new PayoutsPostRequest();
request.requestBody(new HashMap<String, Object>() {{
put("sender_batch_header", new HashMap<String, Object>() {{
put("sender_batch_id", "batch_001");
put("email_subject", "You have a payout!");
}});
put("items", Arrays.asList(new HashMap<String, Object>() {{
put("recipient_type", "EMAIL");
put("amount", new HashMap<String, Object>() {{
put("value", "10.00");
put("currency", "USD");
}});
put("receiver", "recipient@example.com");
put("note", "Thanks for your service!");
put("sender_item_id", "item_001");
}}));
}});

// Send the payout request
client.execute(request);

Check payout status

To check the status of a payout, use the payout batch ID.

// Create a request to get the payout batch status
PayoutsGetRequest request = new PayoutsGetRequest("batch_001");
HttpResponse<PayoutBatch> response = client.execute(request);
String status = response.result().batchHeader().batchStatus();
System.out.println(status);

Use Payouts APIs

You can also use the Payouts APIs directly. This method gives you control over HTTP requests, authentication, and error handling. Use this approach if you need advanced or custom integration.

The following APIs are available for Payouts integration:

For more information and detailed steps, see Use Payouts APIs.

SDK reference