PayPal\Api\Payment::getApprovalLink PHP Method

    public function getApprovalLink()
    {
        return $this->getLink(PayPalConstants::APPROVAL_URL);
    }

Usage Example

 /**
  * Generate the approval link for a PayPal payment
  * @param $amountToPay
  * @return mixed
  */
 public function generateApprovalLink($amountToPay)
 {
     $amountToPay = number_format($amountToPay, 2, ".", "");
     $payer = new Payer();
     $payer->setPaymentMethod("paypal");
     $amount = new Amount();
     $amount->setCurrency($this->currency)->setTotal($amountToPay);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setDescription(trans("billing.paymentToCompany", ['company_name' => Config::get("customer_portal.company_name")]))->setInvoiceNumber(uniqid(true));
     //This is not a payment on a specific invoice, so we'll just generate a unique string, which is what PayPal requires
     $tempToken = new PaypalTemporaryToken(['account_id' => get_user()->account_id, 'token' => uniqid(true)]);
     $tempToken->save();
     $redirectUrls = new RedirectUrls();
     $redirectUrls->setReturnUrl(action("PayPalController@completePayment", ['temporary_token' => $tempToken->token]))->setCancelUrl(action("PayPalController@cancelPayment", ['temporary_token' => $tempToken->token]));
     $payment = new Payment();
     $payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions([$transaction]);
     $payment->create($this->apiContext);
     return $payment->getApprovalLink();
 }
All Usage Examples Of PayPal\Api\Payment::getApprovalLink