src/PayPalRestApiClient/Service/PaymentService.php
public function capture(AccessToken $accessToken, PaymentAuthorizationInterface $paymentAuthorization, $isFinalCapture = true)
    {
        $amount = $paymentAuthorization->getAmount();
        $data = array(
            'amount' => array(
                'total' => $amount->getTotal(),
                'currency' => $amount->getCurrency()
            ),
            'is_final_capture' => $isFinalCapture
        );

        $request = $this->client->createRequest(
            'POST',
            $paymentAuthorization->getCaptureUrl(),
            array(
                'Accept' => 'application/json',
                'Accept-Language' => 'en_US',
                'Authorization' => $accessToken->getTokenType().' '.$accessToken->getAccessToken(),
                'Content-Type' => 'application/json'
            ),
            json_encode($data),
            array(
                'debug' => $this->debug
            )
        );

        $response = $this->send($request, 200, "Payment error:");
        $data = json_decode($response->getBody(), true);

        $captureBuilder = new CaptureBuilder();
        $capture = $captureBuilder->build($data);

        return $capture;
    }
public function capture(AccessToken $accessToken, PaymentAuthorizationInterface $paymentAuthorization, $isFinalCapture = true)
    {
        $amount = $paymentAuthorization->getAmount();
        $data = array(
            'amount' => array(
                'total' => $amount->getTotal(),
                'currency' => $amount->getCurrency()
            ),
            'is_final_capture' => $isFinalCapture
        );

        $request = $this->client->createRequest(
            'POST',
            $paymentAuthorization->getCaptureUrl(),
            array(
                'Accept' => 'application/json',
                'Accept-Language' => 'en_US',
                'Authorization' => $accessToken->getTokenType().' '.$accessToken->getAccessToken(),
                'Content-Type' => 'application/json'
            ),
            json_encode($data),
            array(
                'debug' => $this->debug
            )
        );

        $response = $this->send($request, 200, "Payment error:");
        $data = json_decode($response->getBody(), true);

        $captureBuilder = new CaptureBuilder();
        $capture = $captureBuilder->build($data);

        return $capture;
    }
Capture payment that was previously authorized by the client or witha credit card.

@param PayPalRestApiClient\Model\AccessToken $accessToken
@param PayPalRestApiClient\Model\Payment $payment payment previously authorized with the "PaymentService::authorize" method
@param boolean $isFinalCapture default true

@return PayPalRestApiClient\Model\Capture