src/PayPalRestApiClient/Builder/PaymentRequestBodyBuilder.php
public function build($intent, $payer, $urls, $transactions, $returnArray = false)
    {
        $this->assertIntent($intent);
        $this->intent = $intent;

        $requestBody = array();
        $requestBody['intent'] = $this->intent;
        $requestBody['payer'] = $this->payerBuilder->buildArray($payer);
        $requestBody['transactions'] = $this->transactionsBuilder->buildArray($transactions);
        $requestBody['redirect_urls'] = $this->urlsBuilder->buildArray($urls);

        if ($returnArray) {
            return $requestBody;
        }

        return json_encode($requestBody);
    }
public function build($intent, $payer, $urls, $transactions, $returnArray = false)
    {
        $this->assertIntent($intent);
        $this->intent = $intent;

        $requestBody = array();
        $requestBody['intent'] = $this->intent;
        $requestBody['payer'] = $this->payerBuilder->buildArray($payer);
        $requestBody['transactions'] = $this->transactionsBuilder->buildArray($transactions);
        $requestBody['redirect_urls'] = $this->urlsBuilder->buildArray($urls);

        if ($returnArray) {
            return $requestBody;
        }

        return json_encode($requestBody);
    }
Build an array or a json string that represents the body of a payment request

@param string $intent not null and should be one of the following values: sale, authorize, order
@param array|\ArrayAccess|PayPalRestApiClient\Model\PayerInterface $payer checkout the PayerBuilder documentation
@param array|\ArrayAccess $urls checkout the UrlsBuilder documentation
@param array|\ArrayAccess|PayPalRestApiClient\Model\TransactionInterface $transactions
@param $returnArray boolean default false

@return array|json return by default a json string, if $returnArray is set to true it will return an array

@throws PayPalRestApiClient\Exception\BuilderException if intent is not valid or the other arrays will not pass the validation on the other builders

@see https://developer.paypal.com/docs/api/#payments