Beispiel #1
0
 public function getPaymant()
 {
     $DataArray = [];
     $PayPalConfig = config('paypal.configPaypal');
     $PayPal = new angelleye\PayPal\PayPal($PayPalConfig);
     $SECFields = array('maxamt' => '200.00', 'returnurl' => 'http://shopping.dev/result', 'cancelurl' => 'http://shopping.dev/account', 'reqconfirmshipping' => '0', 'noshipping' => '1', 'allownote' => '1', 'solutiontype' => 'Sole', 'landingpage' => 'Billing', 'brandname' => 'Angell EYE', 'customerservicenumber' => '555-555-5555', 'giftmessageenable' => '1', 'giftreceiptenable' => '1', 'giftwrapenable' => '1', 'giftwrapname' => 'Box with Ribbon', 'giftwrapamount' => '2.50', 'buyeremailoptionenable' => '1', 'surveyenable' => '1', 'buyerregistrationdate' => '2012-07-14T00:00:00Z');
     // Basic array of survey choices.  Nothing but the values should go in here.
     $SurveyChoices = array('Yes', 'No');
     $Payments = array();
     $Payment = array('amt' => '100.00', 'currencycode' => 'USD', 'itemamt' => '80.00', 'shippingamt' => '15.00', 'insuranceoptionoffered' => '', 'handlingamt' => '', 'taxamt' => '5.00', 'desc' => 'This is a test order.', 'notetext' => 'This is a test note before ever having left the web site.', 'paymentaction' => 'Sale');
     $PaymentOrderItems = array();
     $Item = array('name' => 'Widget 123', 'desc' => 'Widget 123', 'amt' => '40.00', 'number' => '123', 'qty' => '1', 'itemurl' => 'http://www.angelleye.com/products/123.php');
     array_push($PaymentOrderItems, $Item);
     $Item = array('name' => 'Widget 456', 'desc' => 'Widget 456', 'amt' => '40.00', 'number' => '456', 'qty' => '1', 'itemurl' => 'http://www.angelleye.com/products/456.php', 'itemcategory' => 'Digital');
     array_push($PaymentOrderItems, $Item);
     $Payment['order_items'] = $PaymentOrderItems;
     array_push($Payments, $Payment);
     $BuyerDetails = array();
     // For shipping options we create an array of all shipping choices similar to how order items works.
     $ShippingOptions = array();
     $Option = array();
     array_push($ShippingOptions, $Option);
     $BillingAgreements = array();
     $Item = array('l_billingtype' => 'MerchantInitiatedBilling', 'l_billingagreementdescription' => 'Billing Agreement', 'l_paymenttype' => 'Any');
     array_push($BillingAgreements, $Item);
     $PayPalRequest = array('SECFields' => $SECFields, 'SurveyChoices' => $SurveyChoices, 'BillingAgreements' => $BillingAgreements, 'Payments' => $Payments);
     $_SESSION['SetExpressCheckoutResult'] = $PayPal->SetExpressCheckout($PayPalRequest);
     echo '<a href="' . $_SESSION['SetExpressCheckoutResult']['REDIRECTURL'] . '">Click here to continue.</a><br /><br />';
     echo '<pre/>';
 }