PayPal\Api\Capture::setAmount PHP Méthode

setAmount() public méthode

The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured.
public setAmount ( Amount $amount )
$amount Amount
    public function setAmount($amount)
    {
        $this->amount = $amount;
        return $this;
    }

Usage Example

 /**
  * @group integration
  */
 public function testOperations()
 {
     try {
         $authId = AuthorizationTest::authorize();
         $auth = Authorization::get($authId);
         $amount = new Amount();
         $amount->setCurrency("USD");
         $amount->setTotal("1.00");
         $captr = new Capture();
         $captr->setId($authId);
         $captr->setAmount($amount);
         $capt = $auth->capture($captr);
         $captureId = $capt->getId();
         $this->assertNotNull($captureId);
         $refund = new Refund();
         $refund->setId($captureId);
         $refund->setAmount($amount);
         $capture = Capture::get($captureId);
         $this->assertNotNull($capture->getId());
         $retund = $capture->refund($refund);
         $this->assertNotNull($retund->getId());
     } catch (PayPalConnectionException $ex) {
         $this->markTestSkipped('Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage());
     }
 }
All Usage Examples Of PayPal\Api\Capture::setAmount