获得批量支付等响应,但我已完成单一同步支付,甚至无法看到成功而是所有时间都面临PENDING batch_status

  1. I am using PAYPAL-PHP-SDK and working on macOS with php version 7.1.4 and laravel version 5.6.* .
  2. I have implemented functionality for single payout provided by paypal but getting response of batch payout.(working with sandbox account)

I also noticed that from merchant account I transferred 1 USD and it successfully transferred to buyer account but though I am getting BATCH_STATUS: "PENDING" also not getting response as paypal showing for Create Single Payout (Synchronously)

I have tried to copy all code from https://paypal.github.io/PayPal-PHP-SDK/sample/doc/payouts/CreateSinglePayout.html and paste to my program and make certain changes related to email address and changed my client key and secret key in bootstrap.php file but though it shows response like BATCH PAYOUT. I noticed one more thing that there is no difference in code between batch payout and single payout. I have also seen https://github.com/paypal/PayPal-node-SDK/issues/264 but though I got batch status PENDING even after money successfully transfer to buyer account.

I also tried to change sync mode from true to false as its now deprecated but though got same response.

Here is my code which I have done in laravel controller

require 'bootstrap.php';
    // Create a new instance of Payout object
    $payouts = new \PayPal\Api\Payout();
$senderBatchHeader = new \PayPal\Api\PayoutSenderBatchHeader();

// #### Batch Header Instance
$senderBatchHeader->setSenderBatchId(uniqid())
    ->setEmailSubject("You have a Payout!");

// #### Sender Item
// Please note that if you are using single payout with sync mode, you can only pass one Item in the request
$senderItem = new \PayPal\Api\PayoutItem();
$senderItem->setRecipientType('Email')
    ->setNote('Thanks for your patronage!')
    ->setReceiver('email@address.com')
    ->setSenderItemId("2014031400023")
    ->setAmount(new \PayPal\Api\Currency({
                        "value":"0.5",
                        "currency":"USD"
                    }));

$payouts->setSenderBatchHeader($senderBatchHeader)
    ->addItem($senderItem);


// For Sample Purposes Only.
$request = clone $payouts;

// ### Create Payout
try {
    // $output = $payouts->createSynchronous($this->_api_context);
    $output = $payouts->createSynchronous($apiContext);
} catch (Exception $ex) {
    ResultPrinter::printError("Created Single Synchronous Payout", "Payout", null, $request, $ex);
    exit(1);
}

 // ResultPrinter::printResult("Created Single Synchronous Payout", "Payout", $output->getBatchHeader()->getPayoutBatchId(), $request, $output);
return $output;

My expected result is something like this,

{
batch_header: {
payout_batch_id: "3975UQGFRGFPQ",
batch_status: "SUCCESS",
sender_batch_header: {
sender_batch_id: "5cd3cfdb8ca8f",
email_subject: "You have a Payout!"
}
},
items: {}
links: [
{
href: "https://api.sandbox.paypal.com/v1/payments/payouts/3975UQGFRGFPQ",
rel: "self",
method: "GET",
enctype: "application/json"
}
]
}

And my actual result is

{ batch_header: { payout_batch_id: "3975UQGFRGFPQ", batch_status: "PENDING", sender_batch_header: { sender_batch_id: "5cd3cfdb8ca8f", email_subject: "You have a Payout!" } }, links: [ { href: "https://api.sandbox.paypal.com/v1/payments/payouts/3975UQGFRGFPQ", rel: "self", method: "GET", enctype: "application/json" } ] }