0

enter image description hereI am working on integrating PayPal Payouts for one of my clients. He has get the Payout feature enabled from them. When I run the transactions via code, I am getting the required response but somehow I am unable to see the transactions when I login to the PayPal Sandbox account. I am also specifying Receiver's Email address so I believe I should be getting emails for the payout too. So the problems are:

  • unable to see the payouts in dashboard
  • not receiving any emails since I specified email address while creating payout items

Here is the code I have written to process Payouts

            Payout payout = new Payout
            {
                sender_batch_header = new PayoutSenderBatchHeader()
                {
                    email_subject = "You recieved a payout!!",
                    recipient_type = PayoutRecipientType.EMAIL,
                    sender_batch_id = "batch_" + Guid.NewGuid().ToString().Substring(0, 8),
                }
            };

            payout.items = new List<PayoutItem>();

            payout.items.Add(new PayoutItem()
            {
                recipient_type = PayoutRecipientType.EMAIL,
                amount = new Currency()
                {
                    currency = "USD",
                    value = amountToBePaid.ToString(),
                },
                note = "Please check your email for details.",
                sender_item_id = "item_" + Guid.NewGuid().ToString().Substring(0, 4),
                receiver = "XXXXXXXXXX@gmail.com",
            });

            payout.items.Add(new PayoutItem()
            {
                recipient_type = PayoutRecipientType.EMAIL,
                amount = new Currency()
                {
                    currency = "USD",
                    value = amountToBePaid.ToString(),
                },
                note = "Please check your email for details.",
                sender_item_id = "item_" + Guid.NewGuid().ToString().Substring(0, 4),
                receiver = "XXXXXXXXXX@gmail.com",
            });

            var createdPayout = payout.Create(token, false);

            var payoutBatch = Payout.Get(token, createdPayout.batch_header.payout_batch_id);

            string status = payoutBatch.batch_header.batch_status;
            string payoutItemId = payoutBatch.items[0].payout_item_id;
            string payoutBatchId = payoutBatch.batch_header.payout_batch_id;

Can anyone advise what I am missing? Any pointers would be highly appreciated


Updating with requested log. API Request:

{
  "batch_header": {
    "payout_batch_id": "XXX",
    "batch_status": "PENDING",
    "time_created": "2022-02-23T07:01:04Z",
    "sender_batch_header": {
      "sender_batch_id": "batch_9f63cf9a",
      "email_subject": "You recieved a payout!!",
      "recipient_type": "EMAIL"
    },
    "amount": {
      "currency": "USD",
      "value": "50.00"
    },
    "fees": {
      "currency": "USD",
      "value": "1.00"
    }
  },
  "items": [
    {
      "payout_item_id": "XXX",
      "transaction_status": "PENDING",
      "payout_item_fee": {
        "currency": "USD",
        "value": "1.00"
      },
      "payout_batch_id": "XXX",
      "payout_item": {
        "recipient_type": "EMAIL",
        "amount": {
          "currency": "USD",
          "value": "50.00"
        },
        "note": "Please check your email for details.",
        "receiver": "channa.development@gmail.com",
        "sender_item_id": "item_a42a"
      },
      "links": [
        {
          "href": "https://api.sandbox.paypal.com/v1/payments/payouts-item/XXX",
          "rel": "item",
          "method": "GET",
          "enctype": "application/json"
        }
      ]
    }
  ],
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/pa youts/XXX?page_size=1000&page=1",
      "rel": "self",
      "method": "GET",
      "enctype": "application/json"
    }
  ]
}

Response:

{
  "batch_header": {
    "payout_batch_id": "XXX",
    "batch_status": "PENDING",
    "sender_batch_header": {
      "sender_batch_id": "batch_9f63cf9a",
      "email_subject": "You recieved a payout!!",
      "recipient_type": "EMAIL"
    }
  },
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/payouts/XXX",
      "rel": "self",
      "method": "GET",
      "enctype": "application/json"
    }
  ]
}
Preston PHX
  • 27,642
  • 4
  • 24
  • 44
Anil C
  • 1,045
  • 3
  • 16
  • 38

1 Answers1

0
      "transaction_status": "PENDING",

If a sandbox account with the specified email address does not exist (or does not have its address confirmed), the transaction will be in pending status. This is the normal behavior.

For live payments, a receiver without a PayPal account will get an email message telling them they have money waiting, with instructions to create an account (or sign in and add this email to an existing account) and thus claim the transaction.

For sandbox there is no way to view such an "email" notification -- the Notifications tab in the developer dashboard only works for notifications sent to existing accounts tied to your developer.paypal.com login; emails that don't exist for any account won't be associated with your developer login, and so have no way to appear in this Notifications tab. If you simply create a sandbox account with that email you'll be able to claim the payment, though.


Anyway, a receiver always has 30 days to claim a pending payment -- otherwise it will be automatically cancelled and the funds returned.

Preston PHX
  • 27,642
  • 4
  • 24
  • 44