src/PaypalLaravel.php
/**
     * @param int $amount
     * @param $tax
     * @param $shipping
     * @param $handling_fee
     * @param $description
     * @return array
     *
     * /v1/payments/payment/
     * used to setup payment with paypal and will return payment id this id can be saved on your billing or payment history table
     *
     */


/v1/payments/payment
used to setup payment with paypal and will return payment id this id can be saved on your billing or payment history table
/ v1 / payments / payment used to setup payment with paypal and will return payment id this id can be saved on your billing or payment history table
public function CreatePayment(int $amount, $tax, $shipping, $handling_fee, $description) : Array
    {
        $this->getAccessToken();
        if (config("paypal-laravel.environment") == "test") {
            $api = new PaypalUtil();
            $response = $api->create_payment_util($this->token, config("paypal-laravel.sandbox_endpoint"), $amount, 0, 0, 0, $description);
        } else {
            $api = new PaypalUtil();
            $response = $api->create_payment_util($this->token, config("paypal-laravel.live_endpoint"), $amount, 0, 0, 0, $description);
        }
        $payment_id = json_decode($response)->id;
        $payment_links = json_decode($response)->links;
        $checkout_link = $payment_links[1]->href;
        $response_array = ["payment_id" => $payment_id, "checkout_link" => $checkout_link];
        return $response_array;
    }
public function CreatePayment ( int $ amount , $ tax , $ shipping , $ handling_fee , $ description ) : Array { $ this -> getAccessToken ( ) ; if ( config ( " paypal-laravel.environment " ) == " test " ) { $ api = new PaypalUtil ( ) ; $ response = $ api -> create_payment_util ( $ this -> token , config ( " paypal-laravel.sandbox_endpoint " ) , $ amount , 0 , 0 , 0 , $ description ) ; } else { $ api = new PaypalUtil ( ) ; $ response = $ api -> create_payment_util ( $ this -> token , config ( " paypal-laravel.live_endpoint " ) , $ amount , 0 , 0 , 0 , $ description ) ; } $ payment_id = json_decode ( $ response ) -> id ; $ payment_links = json_decode ( $ response ) -> links ; $ checkout_link = $ payment_links [ 1 ] -> href ; $ response_array = [ " payment_id " => $ payment_id , " checkout_link " => $ checkout_link ] ; return $ response_array ; }
@param int $amount
 @param $tax
 @param $shipping
 @param $handling_fee
 @param $description
 @return array
@param int $amount @param $tax @param $shipping @param $handling_fee @param $description @return array
//remember to save payment_id once it returns //add validations here to check if payment_id is available