Payouts API integration

DOCS

Last updated: Sept 23rd, 8:37pm

This page describes how to use the Payouts API to send up to 15,000 individual payouts in one API call to email addresses, US mobile phone numbers, or Payer IDs (an encrypted PayPal account number).

Set up your development environment

Before you can integrate Payouts, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get started.

Then, return to this page to integrate Payouts.

Create payout

You can specify up to 15,000 individual payouts in one API call. Exceeding 15,000 payouts in one call returns the HTTP 400 (Bad Request) status code.

The create payout request must include a sender_batch_header object.

Either the sender_batch_header object or each payout item object must include a recipient_type, which specifies the type of receiver data that identifies the recipient.

The recipient_type has one of these values:

EMAIL Unencrypted email.
PAYPAL_ID Encrypted PayPal account number.
PHONE Unencrypted phone number.

These rules apply to the recipient_type:

  • If there's a recipient_type in the sender_batch_header, payout items use the recipient_type in the header unless an item has its own recipient_type.

  • If there's no recipient_type in the sender_batch_header, each payout item must include its own recipient_type.

Include the payouts to individual recipients in the items array in the JSON request body. Specify data for a single payout to one recipient in each item in the array. All items in a payout must specify the same currency.

The recipient_wallet has one of these values:

RECIPIENT_SELECTED Recipient selects where funds are sent.
PAYPAL Funds will be sent to a PayPal account.
VENMO Funds will be sent to a Venmo account.

This sample request creates a payout for four recipients. Because sync_mode=false is the default, it is omitted from the URI.

In this request, the sender_batch_header does not contain a recipient_type attribute. Consequently, each payment in the items array must define a recipient_type:

    1curl -v -X POST https://api-m.sandbox.paypal.com/v1/payments/payouts \
    2 -H "Content-Type: application/json" \
    3 -H "Authorization: Bearer <Access-Token>" \
    4 -d '{
    5 "sender_batch_header": {
    6 "sender_batch_id": "2014021801",
    7 "email_subject": "You have a payout!",
    8 "email_message": "You have received a payout! Thanks for using our service!"
    9 },
    10 "items": [
    11 {
    12 "recipient_type": "EMAIL",
    13 "amount": {
    14 "value": "10.87",
    15 "currency": "USD"
    16 },
    17 "note": "Thanks for your patronage!",
    18 "sender_item_id": "201403140001",
    19 "receiver": "receiver@example.com",
    20 "recipient_wallet": "RECIPIENT_SELECTED"
    21 },
    22 {
    23 "recipient_type": "EMAIL",
    24 "amount": {
    25 "value": "9.87",
    26 "currency": "USD"
    27 },
    28 "note": "Thanks for your patronage!",
    29 "sender_item_id": "201403140002",
    30 "receiver": "receiver@example.com",
    31 "recipient_wallet": "PAYPAL"
    32 },
    33 {
    34 "recipient_type": "PHONE",
    35 "amount": {
    36 "value": "112.34",
    37 "currency": "USD"
    38 },
    39 "note": "Thanks for your support!",
    40 "sender_item_id": "201403140003",
    41 "receiver": "91-734-234-1234"
    42 "recipient_wallet": "VENMO"
    43 },
    44 {
    45 "recipient_type": "PHONE",
    46 "amount": {
    47 "value": "5.32",
    48 "currency": "USD"
    49 },
    50 "note": "Thanks for your patronage!",
    51 "sender_item_id": "201403140004",
    52 "receiver": "408-234-1234",
    53 "recipient_wallet": "PAYPAL"
    54 }
    55 ]
    56}'

    An EMAIL recipient type uses the recipient email address to identify the recipient. A PHONE recipient type uses a domestic phone number to identify the recipient.

    For information about the URI parameters, see Parameters. For information about request body parameters, see Request.

    The response shows information about the payout, including the payout ID:

      1{
      2 "batch_header": {
      3 "sender_batch_header": {
      4 "sender_batch_id": "2014021801",
      5 "email_subject": "You have a payout!"
      6 },
      7 "payout_batch_id": "12345678",
      8 "batch_status": "PENDING"
      9 }
      10}

      Show payout details

      To show details for all items in your payout, use the payout_batch_id from the previous response. You can specify the option fields query parameter to filter the fields that are returned in the response. This example specifies fields=batch_header, which tells the API to return only the batch_header in the response:

        1curl -v -X GET https://api-m.sandbox.paypal.com/v1/payments/payouts/12345678?fields=batch_header \
        2 -H "Content-Type: application/json" \
        3 -H "Authorization: Bearer <Access-Token>"

        The response shows only batch header information for the payout. The batch header information includes the payout batch ID, the batch status, and other information:

          1{
          2 "batch_header": {
          3 "payout_batch_id": "12345678",
          4 "batch_status": "ACKNOWLEDGED",
          5 "time_created": "2014-01-27T10:17:00Z",
          6 "time_completed": "2014-01-27T11:17:39.00Z",
          7 "sender_payout_header": {
          8 "sender_batch_id": "2014021801",
          9 "email_subject": "You have a payout!"
          10 },
          11 "amount": {
          12 "value": "435.85",
          13 "currency": "USD"
          14 }
          15 }
          16}

          For information about the response fields, see Response.

          Duplicate payout requests

          PayPal prevents duplicate batches from being processed. If you specify a sender_batch_id that was used in the last 30 days, the API rejects the request and returns an error message that indicates the duplicate sender_batch_id and includes a HATEOAS link to the original batch payout with the same sender_batch_id. If you receive an HTTP 5nn status code, you can safely retry the request with the same sender_batch_id. In any case, the API completes a payment only once for a specific sender_batch_id that is used within 30 days.

          For more information about the payout status values, see batch_status in the Payouts API reference pages.

          Next

          Test your Payouts API integration.

          Additional information