Obtain the status of a payout item by passing the item ID to the request URI.
public static get ( string $payoutItemId, |
||
$payoutItemId | string | |
$apiContext | is the APIContext for this call. It can be used to pass dynamic configuration and credentials. | |
$restCall | is the Rest Call Service that is used to make rest calls | |
Résultat |
/** * @dataProvider mockProvider * @param PayoutItem $obj */ public function testGet($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(PayoutItemDetailsTest::getJson())); $result = $obj->get("payoutItemId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); }
/** * @depends testCreate * @param $payoutBatch PayoutBatch * @return PayoutBatch */ public function testGetItem($payoutBatch) { $items = $payoutBatch->getItems(); $item = $items[0]; $result = PayoutItem::get($item->getPayoutItemId(), $this->apiContext, $this->mockPayPalRestCall); $this->assertNotNull($result); $this->assertEquals($item->getPayoutItemId(), $result->getPayoutItemId()); $this->assertEquals($item->getPayoutBatchId(), $result->getPayoutBatchId()); $this->assertEquals($item->getTransactionId(), $result->getTransactionId()); $this->assertEquals($item->getPayoutItemFee(), $result->getPayoutItemFee()); }
<?php // # Get Payout Item Status Sample // // Use this call to get data about a payout item, including the status, without retrieving an entire batch. You can get the status of an individual payout item in a batch in order to review the current status of a previously-unclaimed, or pending, payout item. // https://developer.paypal.com/docs/api/#get-the-status-of-a-payout-item // API used: GET /v1/payments/payouts-item/<Payout-Item-Id> /** @var \PayPal\Api\PayoutBatch $payoutBatch */ $payoutBatch = (require 'GetPayoutBatchStatus.php'); // ## Payout Item ID // You can replace this with your Payout Batch Id on already created Payout. $payoutItem = $payoutBatch->getItems()[0]; $payoutItemId = $payoutItem->getPayoutItemId(); // ### Get Payout Item Status try { $output = \PayPal\Api\PayoutItem::get($payoutItemId, $apiContext); } catch (Exception $ex) { ResultPrinter::printError("Get Payout Item Status", "PayoutItem", null, $payoutItemId, $ex); exit(1); } ResultPrinter::printResult("Get Payout Item Status", "PayoutItem", $output->getPayoutItemId(), null, $output); return $output;