public function setExpressCheckout($data, $subscription = false)
    {
        $this->setItemSubTotal($data);

        $this->post = $this->setCartItems($data['items'])->merge([
            'PAYMENTREQUEST_0_ITEMAMT'       => $this->subtotal,
            'PAYMENTREQUEST_0_AMT'           => $data['total'],
            'PAYMENTREQUEST_0_PAYMENTACTION' => $this->paymentAction,
            'PAYMENTREQUEST_0_CURRENCYCODE'  => $this->currency,
            'PAYMENTREQUEST_0_DESC'          => $data['invoice_description'],
            'PAYMENTREQUEST_0_INVNUM'        => $data['invoice_id'],
            'NOSHIPPING'                     => 1,
            'RETURNURL'                      => $data['return_url'],
            'CANCELURL'                      => $data['cancel_url'],
            'LOCALE'                         => $this->locale,
        ]);

        $this->setShippingAmount($data);

        $this->setShippingDiscount($data);

        $this->setExpressCheckoutRecurringPaymentConfig($data, $subscription);

        $response = $this->doPayPalRequest('SetExpressCheckout');

        return collect($response)->merge([
            'paypal_link' => !empty($response['TOKEN']) ? $this->config['gateway_url'].'/webscr?cmd=_express-checkout&token='.$response['TOKEN'] : null,
        ])->toArray();
    }
public function setExpressCheckout($data, $subscription = false)
    {
        $this->setItemSubTotal($data);

        $this->post = $this->setCartItems($data['items'])->merge([
            'PAYMENTREQUEST_0_ITEMAMT'       => $this->subtotal,
            'PAYMENTREQUEST_0_AMT'           => $data['total'],
            'PAYMENTREQUEST_0_PAYMENTACTION' => $this->paymentAction,
            'PAYMENTREQUEST_0_CURRENCYCODE'  => $this->currency,
            'PAYMENTREQUEST_0_DESC'          => $data['invoice_description'],
            'PAYMENTREQUEST_0_INVNUM'        => $data['invoice_id'],
            'NOSHIPPING'                     => 1,
            'RETURNURL'                      => $data['return_url'],
            'CANCELURL'                      => $data['cancel_url'],
            'LOCALE'                         => $this->locale,
        ]);

        $this->setShippingAmount($data);

        $this->setShippingDiscount($data);

        $this->setExpressCheckoutRecurringPaymentConfig($data, $subscription);

        $response = $this->doPayPalRequest('SetExpressCheckout');

        return collect($response)->merge([
            'paypal_link' => !empty($response['TOKEN']) ? $this->config['gateway_url'].'/webscr?cmd=_express-checkout&token='.$response['TOKEN'] : null,
        ])->toArray();
    }
public function setExpressCheckout ( $ data , $ subscription = false ) { $ this -> setItemSubTotal ( $ data ) ; $ this -> post = $ this -> setCartItems ( $ data [ 'items' ] ) -> merge ( [ 'PAYMENTREQUEST_0_ITEMAMT' => $ this -> subtotal , 'PAYMENTREQUEST_0_AMT' => $ data [ 'total' ] , 'PAYMENTREQUEST_0_PAYMENTACTION' => $ this -> paymentAction , 'PAYMENTREQUEST_0_CURRENCYCODE' => $ this -> currency , 'PAYMENTREQUEST_0_DESC' => $ data [ 'invoice_description' ] , 'PAYMENTREQUEST_0_INVNUM' => $ data [ 'invoice_id' ] , 'NOSHIPPING' => 1 , 'RETURNURL' => $ data [ 'return_url' ] , 'CANCELURL' => $ data [ 'cancel_url' ] , 'LOCALE' => $ this -> locale , ] ) ; $ this -> setShippingAmount ( $ data ) ; $ this -> setShippingDiscount ( $ data ) ; $ this -> setExpressCheckoutRecurringPaymentConfig ( $ data , $ subscription ) ; $ response = $ this -> doPayPalRequest ( 'SetExpressCheckout' ) ; return collect ( $ response ) -> merge ( [ 'paypal_link' => ! empty ( $ response [ 'TOKEN' ] ) ? $ this -> config [ 'gateway_url' ] . '/webscr?cmd=_express-checkout&token=' . $ response [ 'TOKEN' ] : null , ] ) -> toArray ( ) ; }
Perform a SetExpressCheckout API call on PayPal.

@param array $data
@param bool  $subscription

@throws \Exception

@return array|\Psr\Http\Message\StreamInterface
Perform a SetExpressCheckout API call on PayPal .