public function setEC() { //set creentials $this->set_credentials(); $PayPalConfig = array('Sandbox' => $this->payment_mode, 'APIUsername' => trim($this->api_username), 'APIPassword' => trim($this->api_password), 'APISignature' => trim($this->api_signature), 'APIVersion' => '97.0', 'APISubject' => '', 'PrintHeaders' => false, 'LogResults' => false, 'LogPath' => ''); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); $SECFields = array('token' => '', 'maxamt' => '', 'returnurl' => $this->_return_url, 'cancelurl' => $this->_cancel_url, 'callback' => '', 'callbacktimeout' => '', 'callbackversion' => '', 'reqconfirmshipping' => '0', 'noshipping' => '', 'allownote' => '1', 'addroverride' => '1', 'localecode' => '', 'pagestyle' => isset($this->_page_design['pagestyle']) ? $this->_page_design['pagestyle'] : '', 'hdrimg' => isset($this->_page_design['hdrimg']) ? $this->_page_design['hdrimg'] : '', 'logoimg' => isset($this->_page_design['logoimg']) ? $this->_page_design['logoimg'] : '', 'cartbordercolor' => isset($this->_page_design['cartbordercolor']) ? $this->_page_design['cartbordercolor'] : '', 'hdrbordercolor' => isset($this->_page_design['hdrbordercolor']) ? $this->_page_design['hdrbordercolor'] : '', 'hdrbackcolor' => isset($this->_page_design['hdrbackcolor']) ? $this->_page_design['hdrbackcolor'] : '', 'payflowcolor' => isset($this->_page_design['payflowcolor']) ? $this->_page_design['payflowcolor'] : '', 'skipdetails' => '', 'email' => '', 'solutiontype' => 'Sole', 'landingpage' => 'Login', 'channeltype' => 'Merchant', 'giropaysuccessurl' => '', 'giropaycancelurl' => '', 'banktxnpendingurl' => '', 'brandname' => isset($this->_page_design['channel_name']) ? $this->_page_design['channel_name'] : '', 'customerservicenumber' => '', 'giftmessageenable' => '', 'giftreceiptenable' => '', 'giftwrapenable' => '', 'giftwrapname' => 'Box with Ribbon', 'giftwrapamount' => '', 'buyeremailoptionenable' => '1', 'surveyquestion' => '', 'surveyenable' => '1', 'buyerid' => '', 'buyerusername' => '', 'buyerregistrationdate' => '', 'allowpushfunding' => ''); // Basic array of survey choices. Nothing but the values should go in here. $SurveyChoices = array('Yes', 'No'); $PaymentOrderItems = array(); $itemTotalValue = 0; $taxTotalValue = 0; foreach ($this->_cart as $val) { $itemTotalValue += $val['price'] * $val['qty']; $Item = array('name' => $val['name'], 'desc' => strip_tags($val['desc']), 'amt' => $val['price'], 'number' => $val['options']['product_id'], 'qty' => $val['qty'], 'taxamt' => 0, 'itemurl' => '', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => ''); array_push($PaymentOrderItems, $Item); } if (!empty($this->_discount) && $this->_discount != 0) { $itemTotalValue += -round_amount($this->_discount); $discount_apply = array('name' => 'Discount', 'amt' => -round_amount($this->_discount), 'number' => '', 'qty' => 1, 'taxamt' => 0); array_push($PaymentOrderItems, $discount_apply); } if (!empty($this->_coupon) && $this->_coupon != 0) { $itemTotalValue += -round_amount($this->_coupon); $coupon_apply = array('name' => 'Coupon', 'amt' => -round_amount($this->_coupon), 'number' => '', 'qty' => 1, 'desc' => $_SESSION['coupon_details']['code'], 'taxamt' => 0); array_push($PaymentOrderItems, $coupon_apply); } $shippingTotal = round_amount($this->_shipping_charge); $taxTotalValue = round_amount($this->_tax); $discountTotal = round_amount($this->_discount); $orderTotal = $itemTotalValue + $taxTotalValue + $shippingTotal; $orderTotal = $orderTotal - $this->_shipping_discount; $Payments = array(); $Payment = array('amt' => round_amount($orderTotal), 'currencycode' => 'USD', 'itemamt' => $itemTotalValue, 'shippingamt' => $shippingTotal, 'shipdiscamt' => -$this->_shipping_discount, 'insuranceoptionoffered' => '', 'handlingamt' => '', 'redeemedofferamount' => '', 'taxamt' => $taxTotalValue, 'desc' => '', 'custom' => '', 'invnum' => '', 'notifyurl' => $this->_notify_url, 'shiptoname' => $this->address_fill('S', 'name'), 'shiptostreet' => $this->address_fill('S', 'address'), 'shiptocity' => $this->address_fill('S', 'city'), 'shiptostate' => $this->address_fill('S', 'state'), 'shiptozip' => $this->address_fill('S', 'zip_code'), 'shiptocountry' => $this->address_fill('S', 'country'), 'shiptophonenum' => $this->address_fill('S', 'phone'), 'notetext' => '', 'allowedpaymentmethod' => 'InstantPaymentOnly', 'paymentaction' => 'Sale', 'paymentrequestid' => '', 'sellerpaypalaccountid' => ''); $Payment['order_items'] = $PaymentOrderItems; array_push($Payments, $Payment); $BuyerDetails = array('buyerid' => '', 'buyerusername' => '', 'buyerregistrationdate' => ''); // For shipping options we create an array of all shipping choices similar to how order items works. $ShippingOptions = array(); $Option = array('l_shippingoptionisdefault' => '', 'l_shippingoptionname' => '', 'l_shippingoptionlabel' => '', 'l_shippingoptionamount' => ''); array_push($ShippingOptions, $Option); $BillingAgreements = array(); $Item = array('l_billingtype' => 'MerchantInitiatedBilling', 'l_billingagreementdescription' => 'Billing Agreement', 'l_paymenttype' => 'Any', 'l_billingagreementcustom' => ''); array_push($BillingAgreements, $Item); $PayPalRequest = array('SECFields' => $SECFields, 'SurveyChoices' => $SurveyChoices, 'BillingAgreements' => $BillingAgreements, 'Payments' => $Payments); $SetExpressCheckoutResult = $PayPal->SetExpressCheckout($PayPalRequest); //echo '<a href="' . $SetExpressCheckoutResult['REDIRECTURL'] . '">Click here to continue.</a><br /><br />'; //echo '<pre />'; return $SetExpressCheckoutResult; }
public function doEC() { $this->set_credentials(); $PayPalConfig = array('Sandbox' => $this->payment_mode, 'APIUsername' => trim($this->api_username), 'APIPassword' => trim($this->api_password), 'APISignature' => trim($this->api_signature), 'APIVersion' => '97.0', 'APISubject' => '', 'PrintHeaders' => false, 'LogResults' => false, 'LogPath' => ''); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); $DECPFields = array('token' => $this->_token, 'payerid' => $this->_payer_id, 'returnfmfdetails' => '', 'giftmessage' => '', 'giftreceiptenable' => '', 'giftwrapname' => '', 'giftwrapamount' => '', 'buyermarketingemail' => '', 'surveyquestion' => '', 'surveychoiceselected' => '', 'allowedpaymentmethod' => 'InstantPaymentOnly', 'buttonsource' => ''); $PaymentOrderItems = array(); $itemTotalValue = 0; $taxTotalValue = 0; foreach ($this->_cart as $val) { $itemTotalValue += $val['price'] * $val['qty']; $Item = array('name' => $val['name'], 'desc' => strip_tags($val['desc']), 'amt' => $val['price'], 'number' => $val['options']['product_id'], 'qty' => $val['qty'], 'taxamt' => 0, 'itemurl' => '', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => ''); array_push($PaymentOrderItems, $Item); } if (!empty($this->_discount) && $this->_discount != 0) { $itemTotalValue += -round_amount($this->_discount); $discount_apply = array('name' => 'Discount', 'amt' => -round_amount($this->_discount), 'number' => '', 'qty' => 1, 'taxamt' => 0); array_push($PaymentOrderItems, $discount_apply); } if (!empty($this->_coupon) && $this->_coupon != 0) { $itemTotalValue += -round_amount($this->_coupon); $coupon_apply = array('name' => 'Coupon', 'amt' => -round_amount($this->_coupon), 'number' => '', 'qty' => 1, 'taxamt' => 0, 'desc' => $_SESSION['coupon_details']['code']); array_push($PaymentOrderItems, $coupon_apply); } $shippingTotal = round_amount($this->_shipping_charge); $taxTotalValue = round_amount($this->_tax); $discountTotal = round_amount($this->_discount); $orderTotal = $itemTotalValue + $taxTotalValue + $shippingTotal; $orderTotal = $orderTotal - $this->_shipping_discount; $Payments = array(); $Payment = array('amt' => round_amount($orderTotal), 'currencycode' => 'USD', 'itemamt' => $itemTotalValue, 'shippingamt' => $shippingTotal, 'shipdiscamt' => -$this->_shipping_discount, 'insuranceoptionoffered' => '', 'handlingamt' => '', 'redeemedofferamount' => '', 'taxamt' => $taxTotalValue, 'desc' => 'This is a test order.', 'custom' => http_build_query($this->_custom), 'invnum' => '', 'notifyurl' => $this->_notify_url, 'shiptoname' => $this->address_fill('S', 'name'), 'shiptostreet' => $this->address_fill('S', 'address'), 'shiptocity' => $this->address_fill('S', 'city'), 'shiptostate' => $this->address_fill('S', 'state'), 'shiptozip' => $this->address_fill('S', 'zip_code'), 'shiptocountry' => $this->address_fill('S', 'country'), 'shiptophonenum' => $this->address_fill('S', 'phone'), 'notetext' => 'This is a test note before ever having left the web site.', 'allowedpaymentmethod' => 'InstantPaymentOnly', 'paymentaction' => 'Sale', 'paymentrequestid' => '', 'sellerpaypalaccountid' => ''); $Payment['order_items'] = $PaymentOrderItems; array_push($Payments, $Payment); $UserSelectedOptions = array('shippingcalculationmode' => '', 'insuranceoptionselected' => '', 'shippingoptionisdefault' => '', 'shippingoptionamount' => '', 'shippingoptionname' => ''); $PayPalRequest = array('DECPFields' => $DECPFields, 'Payments' => $Payments); $PayPalResult = $PayPal->DoExpressCheckoutPayment($PayPalRequest); return $PayPalResult; }
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $DNRCFields = array('amt' => '', 'netamt' => '', 'shippingamt' => '', 'taxamt' => '', 'currencycode' => '', 'note' => ''); $CCDetails = array('creditcardtype' => '', 'acct' => '', 'expdate' => '', 'cvv2' => '', 'startdate' => '', 'issuenumber' => ''); $PayerInfo = array('email' => '', 'firstname' => '', 'lastname' => ''); $PayerName = array('salutation' => '', 'firstname' => '', 'middlename' => '', 'lastname' => '', 'suffix' => ''); $BillingAddress = array('street' => '', 'street2' => '', 'city' => '', 'state' => '', 'countrycode' => '', 'zip' => '', 'phonenum' => ''); $PayPalRequestData = array('DNRCFields' => $DNRCFields, 'CCDetails' => $CCDetails, 'PayerInfo' => $PayerInfo, 'PayerName' => $PayerName, 'BillingAddress' => $BillingAddress); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->DoNonReferencedCredit($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $BMManageButtonStatusFields = array('hostedbuttonid' => 'C3TRVEHPLKZ2N', 'buttonstatus' => 'DELETE'); $PayPalRequestData = array('BMManageButtonStatusFields' => $BMManageButtonStatusFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->BMManageButtonStatus($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php if (!session_id()) { session_start(); } require_once '../includes/config.php'; require_once '../autoload.php'; $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APIVersion' => '97.0', 'APISubject' => '', 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); $SECFields = array('token' => '', 'maxamt' => '200.00', 'returnurl' => $domain . 'standard/samples/DoExpressCheckoutPayment-Callback.php', 'cancelurl' => $domain . 'standard/cancel.php', 'callback' => $domain . 'standard/includes/paypal.nvp.callback.php', 'callbacktimeout' => '6', 'callbackversion' => '', 'reqconfirmshipping' => '0', 'noshipping' => '', 'allownote' => '1', 'addroverride' => '', 'localecode' => '', 'pagestyle' => '', 'hdrimg' => '', 'hdrbordercolor' => '', 'hdrbackcolor' => '', 'payflowcolor' => '', 'skipdetails' => '1', 'email' => '', 'solutiontype' => 'Sole', 'landingpage' => 'Login', 'channeltype' => '', 'giropaysuccessurl' => '', 'giropaycancelurl' => '', 'banktxnpendingurl' => '', 'brandname' => 'Angell EYE', 'customerservicenumber' => '555-555-5555', 'giftmessageenable' => '1', 'giftreceiptenable' => '1', 'giftwrapenable' => '1', 'giftwrapname' => 'Box with Ribbon', 'giftwrapamount' => '2.50', 'buyeremailoptionenable' => '1', 'surveyquestion' => '', 'surveyenable' => '1', 'buyerid' => '', 'buyerusername' => '', 'buyerregistrationdate' => '2012-07-14T00:00:00Z', 'allowpushfunding' => ''); // Basic array of survey choices. Nothing but the values should go in here. $SurveyChoices = array('Yes', 'No'); $Payments = array(); $Payment = array('amt' => '81.00', 'currencycode' => 'USD', 'itemamt' => '80.00', 'shippingamt' => '1.00', 'insuranceoptionoffered' => '', 'handlingamt' => '', 'taxamt' => '', 'desc' => 'This is a test order.', 'custom' => '', 'invnum' => '', 'notifyurl' => '', 'shiptoname' => '', 'shiptostreet' => '', 'shiptostreet2' => '', 'shiptocity' => '', 'shiptostate' => '', 'shiptozip' => '', 'shiptocountry' => '', 'shiptophonenum' => '', 'notetext' => 'This is a test note before ever having left the web site.', 'allowedpaymentmethod' => '', 'paymentaction' => 'Sale', 'paymentrequestid' => '', 'sellerpaypalaccountid' => ''); $PaymentOrderItems = array(); $Item = array('name' => 'Widget 123', 'desc' => 'Widget 123', 'amt' => '40.00', 'number' => '123', 'qty' => '1', 'taxamt' => '', 'itemurl' => 'http://www.angelleye.com/products/123.php', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => ''); array_push($PaymentOrderItems, $Item); $Item = array('name' => 'Widget 456', 'desc' => 'Widget 456', 'amt' => '40.00', 'number' => '456', 'qty' => '1', 'taxamt' => '', 'itemurl' => 'http://www.angelleye.com/products/456.php', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => ''); array_push($PaymentOrderItems, $Item); $Payment['order_items'] = $PaymentOrderItems; array_push($Payments, $Payment); $BuyerDetails = array('buyerid' => '', 'buyerusername' => '', 'buyerregistrationdate' => ''); // For shipping options we create an array of all shipping choices similar to how order items works. $ShippingOptions = array(); $Option = array('l_shippingoptionisdefault' => 'true', 'l_shippingoptionname' => 'UPS', 'l_shipingpoptionlabel' => 'UPS', 'l_shippingoptionamount' => '1.00', 'l_taxamt' => '0.00', 'l_insuranceamount' => '1.00'); array_push($ShippingOptions, $Option); $Option = array('l_shippingoptionisdefault' => 'false', 'l_shippingoptionname' => 'UPS', 'l_shipingpoptionlabel' => 'UPS', 'l_shippingoptionamount' => '18.00', 'l_taxamt' => '0.00', 'l_insuranceamount' => '1.00'); array_push($ShippingOptions, $Option); $BillingAgreements = array(); $Item = array('l_billingtype' => 'MerchantInitiatedBilling', 'l_billingagreementdescription' => 'Billing Agreement', 'l_paymenttype' => 'Any', 'l_billingagreementcustom' => ''); array_push($BillingAgreements, $Item);
<?php require_once '../includes/config.php'; require_once '../autoload.php'; $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); $DPFields = array('paymentaction' => 'Sale', 'ipaddress' => $_SERVER['REMOTE_ADDR'], 'returnfmfdetails' => '1'); $CCDetails = array('creditcardtype' => 'MasterCard', 'acct' => '5522340006063638', 'expdate' => '022016', 'cvv2' => '456', 'startdate' => '', 'issuenumber' => ''); $PayerInfo = array('email' => '*****@*****.**', 'payerid' => '', 'payerstatus' => '', 'business' => ''); $PayerName = array('salutation' => '', 'firstname' => 'Tester', 'middlename' => '', 'lastname' => 'Testerson', 'suffix' => ''); $BillingAddress = array('street' => '707 W. Bay Drive', 'street2' => '', 'city' => 'Largo', 'state' => 'FL', 'countrycode' => 'US', 'zip' => '33770', 'phonenum' => ''); $ShippingAddress = array('shiptoname' => '', 'shiptostreet' => '', 'shiptostreet2' => '', 'shiptocity' => '', 'shiptostate' => '', 'shiptozip' => '', 'shiptocountrycode' => '', 'shiptophonenum' => ''); $PaymentDetails = array('amt' => '3.00', 'currencycode' => 'USD', 'itemamt' => '', 'shippingamt' => '', 'handlingamt' => '', 'taxamt' => '', 'desc' => 'Testing Payments Pro DESC Field', 'custom' => 'TEST', 'invnum' => '', 'buttonsource' => '', 'notifyurl' => ''); $OrderItems = array(); $Item = array('l_name' => 'Test Widget', 'l_desc' => 'This is a test widget description.', 'l_amt' => '1.00', 'l_number' => 'ABC-123', 'l_qty' => '1', 'l_taxamt' => '', 'l_ebayitemnumber' => '', 'l_ebayitemauctiontxnid' => '', 'l_ebayitemorderid' => ''); array_push($OrderItems, $Item); $Item = array('l_name' => 'Test Widget 2', 'l_desc' => 'This is a test widget description.', 'l_amt' => '2.00', 'l_number' => 'ABC-XYZ', 'l_qty' => '1', 'l_taxamt' => '', 'l_ebayitemnumber' => '', 'l_ebayitemauctiontxnid' => '', 'l_ebayitemorderid' => ''); array_push($OrderItems, $Item); $PayPalRequestData = array('DPFields' => $DPFields, 'CCDetails' => $CCDetails, 'PayerInfo' => $PayerInfo, 'PayerName' => $PayerName, 'BillingAddress' => $BillingAddress, 'PaymentDetails' => $PaymentDetails, 'OrderItems' => $OrderItems); $PayPalResult = $PayPal->DoDirectPayment($PayPalRequestData); $_SESSION['transaction_id'] = isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : ''; echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $AVFields = array('email' => '', 'street' => '', 'zip' => ''); $PayPalRequestData = array('AVFields' => $AVFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->AddressVerify($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $RTFields = array('transactionid' => 'ABC', 'payerid' => '', 'invoiceid' => '', 'refundtype' => 'Full', 'amt' => '', 'currencycode' => '', 'note' => '', 'retryuntil' => '', 'refundsource' => '', 'merchantstoredetail' => '', 'refundadvice' => '', 'refunditemdetails' => '', 'msgsubid' => '', 'storeid' => '', 'terminalid' => '', 'shippingamt' => '', 'taxamt' => ''); // You may include up to 16 $MerchantDataVar arrays within the $MerchantDataVars array. $MerchantDataVars = array(); $MerchantDataVar = array('key' => 'Key1', 'value' => 'Value1'); array_push($MerchantDataVars, $MerchantDataVar); $MerchantDataVar = array('key' => 'Key2', 'value' => 'Value2'); array_push($MerchantDataVars, $MerchantDataVar); $PayPalRequestData = array('RTFields' => $RTFields, 'MerchantDataVars' => $MerchantDataVars); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->RefundTransaction($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $SCBAFields = array('returnurl' => $domain . 'return.php', 'cancelurl' => $domain . 'cancel.php', 'localcode' => '', 'pagestyle' => '', 'hdrimg' => $domain . 'images/hdrimg.jpg', 'hdrbordercolor' => '', 'hdrbackcolor' => '', 'payflowcolor' => '', 'email' => ''); $BillingAgreements = array(); $Item = array('l_billingtype' => 'RecurringPayments', 'l_billingagreementdescription' => 'PersonalTraining', 'l_paymenttype' => '', 'l_billingagreementcustom' => 'Client #324'); array_push($BillingAgreements, $Item); $PayPalRequestData = array('SCBAFields' => $SCBAFields, 'BillingAgreements' => $BillingAgreements); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->SetCustomerBillingAgreement($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $BMSetInventoryFields = array('hostedbuttonid' => '3J9D98TNZHJDC', 'trackinv' => '1', 'trackpnl' => '1', 'optionnameindex' => '', 'soldouturl' => 'http://www.domain.com/soldout', 'reusedigitaldownloadkeys' => '0', 'appenddigitaldownloadkeys' => '1'); // One or more digital downloads keys, up to a max of 1k. $DigitalDownloadKeys = array('key1', 'key2', 'etc'); $ItemTrackingDetails = array('itemnumber' => '123ABC', 'itemqty' => '25', 'itemqtydelta' => '', 'itemalert' => '5', 'itemcost' => '1.00'); // Here we can have up to 10 $OptionTrackingDetail arrays loaded into $OptionTrackingDetails $OptionTrackingDetails = array(); $OptionTrackingDetail = array('number' => '123ABC-Blue', 'qty' => '10', 'select' => 'Blue', 'qtydelta' => '', 'alert' => '3', 'cost' => '1.00'); array_push($OptionTrackingDetails, $OptionTrackingDetail); $OptionTrackingDetail = array('number' => '123ABC-Red', 'qty' => '10', 'select' => 'Red', 'qtydelta' => '', 'alert' => '3', 'cost' => '1.00'); array_push($OptionTrackingDetails, $OptionTrackingDetail); $OptionTrackingDetail = array('number' => '123ABC-Green', 'qty' => '5', 'select' => 'Green', 'qtydelta' => '', 'alert' => '3', 'cost' => '1.00'); array_push($OptionTrackingDetails, $OptionTrackingDetail); $PayPalRequestData = array('BMSetInventoryFields' => $BMSetInventoryFields, 'DigitalDownloadKeys' => $DigitalDownloadKeys, 'ItemTrackingDetails' => $ItemTrackingDetails, 'OptionTrackingDetails' => $OptionTrackingDetails); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->BMSetInventory($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $GBFields = array('returnallcurrencies' => true); $PayPalRequestData = array('GBFields' => $GBFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetBalance($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $SetAuthFlowParamFields = array('ReturnURL' => '', 'CancelURL' => '', 'LogoutURL' => '', 'LocalCode' => '', 'PageStyle' => '', 'HDRIMG' => '', 'HDRBorderColor' => '', 'HDRBackColor' => '', 'PayFlowColor' => '', 'InitFlowType' => '', 'FirstName' => '', 'LastName' => '', 'ServiceName1' => 'Name', 'ServiceName2' => 'Email', 'ServiceDefReq1' => 'Required', 'ServiceDefReq2' => 'Required'); $ShippingAddress = array('ShipToName' => '', 'ShipToStreet' => '', 'ShipToStreet2' => '', 'ShipToCity' => '', 'ShipToState' => '', 'ShipToZip' => '', 'ShipToCountryCode' => ''); $PayPalRequestData = array('SetAuthFlowParamFields' => $SetAuthFlowParamFields, 'ShippingAddress' => $ShippingAddress); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->SetAuthFlowParam($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $GBFields = array('returnallcurrencies' => ''); $PayPalRequestData = array('GBFields' => $GBFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetBalance($PayPalRequestData); if ($PayPal->APICallSuccessful($PayPalResult['ACK'])) { } // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php /** * Include our config file and the PayPal library. */ require_once '../../includes/config.php'; require_once '../../vendor/angelleye/paypal-php-library/autoload.php'; /** * Setup configuration for the PayPal library using vars from the config file. * Then load the PayPal object into $PayPal */ $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); /** * Now we setup the parameters for the reference transaction. * This is where we use the transaction ID or billing agreement ID * from a previous Express Checkout (or Payments Pro) transaction. */ $ReferenceID = '5C787706TD803561H'; $DRTFields = array('referenceid' => $ReferenceID, 'paymentaction' => 'Sale', 'ipaddress' => $_SERVER['REMOTE_ADDR']); /** * Here we'll setup the payment details for the reference transaction * that we are processing. */ $PaymentDetails = array('amt' => '10.00', 'currencycode' => 'USD'); /** * Now we gather all of the arrays above into a single array. */ $PayPalRequestData = array('DRTFields' => $DRTFields, 'PaymentDetails' => $PaymentDetails); /** * Here we are making the call to the DoExpressCheckoutPayment function in the library,
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $SECFields = array('token' => '', 'maxamt' => '', 'returnurl' => '', 'cancelurl' => '', 'callback' => '', 'callbacktimeout' => '', 'callbackversion' => '', 'reqconfirmshipping' => '', 'noshipping' => '', 'allownote' => '', 'addroverride' => '', 'localecode' => '', 'pagestyle' => '', 'hdrimg' => '', 'hdrbordercolor' => '', 'hdrbackcolor' => '', 'payflowcolor' => '', 'cartbordercolor' => '', 'logoimg' => '', 'skipdetails' => '', 'email' => '', 'solutiontype' => '', 'landingpage' => '', 'channeltype' => '', 'giropaysuccessurl' => '', 'giropaycancelurl' => '', 'banktxnpendingurl' => '', 'brandname' => '', 'customerservicenumber' => '', 'giftmessageenable' => '', 'giftreceiptenable' => '', 'giftwrapenable' => '', 'giftwrapname' => '', 'giftwrapamount' => '', 'buyeremailoptionenable' => '', 'surveyquestion' => '', 'surveyenable' => '', 'totaltype' => '', 'notetobuyer' => '', 'buyerid' => '', 'buyerusername' => '', 'buyerregistrationdate' => '', 'allowpushfunding' => '', 'userselectedfundingsource' => '', 'taxidtype' => '', 'taxid' => ''); // Basic array of survey choices. Nothing but the values should go in here. $SurveyChoices = array('Choice 1', 'Choice2', 'Choice3', 'etc'); $Payments = array(); $Payment = array('amt' => '', 'bucketcategorytype' => '', 'currencycode' => '', 'itemamt' => '', 'shippingamt' => '', 'shipdiscamt' => '', 'insuranceamt' => '', 'insuranceoptionoffered' => '', 'handlingamt' => '', 'taxamt' => '', 'desc' => '', 'custom' => '', 'invnum' => '', 'notifyurl' => '', 'multishipping' => '', 'shiptoname' => '', 'shiptostreet' => '', 'shiptostreet2' => '', 'shiptocity' => '', 'shiptostate' => '', 'shiptozip' => '', 'shiptocountrycode' => '', 'shiptophonenum' => '', 'notetext' => '', 'allowedpaymentmethod' => '', 'paymentaction' => '', 'paymentrequestid' => '', 'sellerpaypalaccountid' => '', 'transactionid' => ''); $PaymentOrderItems = array(); $Item = array('name' => '', 'desc' => '', 'amt' => '', 'number' => '', 'qty' => '', 'taxamt' => '', 'itemurl' => '', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => ''); array_push($PaymentOrderItems, $Item); $Payment['order_items'] = $PaymentOrderItems; array_push($Payments, $Payment); $BuyerDetails = array('buyerid' => '', 'buyerusername' => '', 'buyerregistrationdate' => ''); // For shipping options we create an array of all shipping choices similar to how order items works. $ShippingOptions = array(); $Option = array('l_shippingoptionisdefault' => '', 'l_shippingoptionname' => '', 'l_shippingoptionlabel' => '', 'l_shippingoptionamount' => ''); array_push($ShippingOptions, $Option); $BillingAgreements = array(); $Item = array('l_billingtype' => '', 'l_billingagreementdescription' => '', 'l_paymenttype' => '', 'l_billingagreementcustom' => ''); array_push($BillingAgreements, $Item); $PayPalRequestData = array('SECFields' => $SECFields, 'SurveyChoices' => $SurveyChoices, 'Payments' => $Payments, 'BuyerDetails' => $BuyerDetails, 'ShippingOptions' => $ShippingOptions, 'BillingAgreements' => $BillingAgreements); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->SetExpressCheckout($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes.
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $Token = ''; $PayPalResult = $PayPal->GetAccessPermissionsDetails($Token); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $URPPFields = array('profileid' => '', 'note' => '', 'desc' => '', 'subscribername' => '', 'profilereference' => '', 'additionalbillingcycles' => '', 'amt' => '', 'shippingamt' => '', 'taxamt' => '', 'outstandingamt' => '', 'autobilloutamt' => '', 'maxfailedpayments' => '', 'profilestartdate' => ''); $BillingAddress = array('street' => '', 'street2' => '', 'city' => '', 'state' => '', 'countrycode' => '', 'zip' => '', 'phonenum' => ''); $ShippingAddress = array('shiptoname' => '', 'shiptostreet' => '', 'shiptostreet2' => '', 'shiptocity' => '', 'shiptostate' => '', 'shiptozip' => '', 'shiptocountry' => '', 'shiptophonenum' => ''); $BillingPeriod = array('trialbillingperiod' => '', 'trialbillingfrequency' => '', 'trialtotalbillingcycles' => '', 'trialamt' => '', 'billingperiod' => '', 'billingfrequency' => '', 'totalbillingcycles' => '', 'amt' => '', 'currencycode' => ''); $CCDetails = array('creditcardtype' => '', 'acct' => '', 'expdate' => '', 'cvv2' => '', 'startdate' => '', 'issuenumber' => ''); $PayerInfo = array('email' => '', 'firstname' => '', 'lastname' => ''); $PayPalRequestData = array('URPPFields' => $URPPFields, 'BillingAddress' => $BillingAddress, 'ShippingAddress' => $ShippingAddress, 'BillingPeriod' => $BillingPeriod, 'CCDetails' => $CCDetails, 'PayerInfo' => $PayerInfo); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->UpdateRecurringPaymentsProfile($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php /** * Include our config file and the PayPal library. */ require_once '../../includes/config.php'; require_once '../../vendor/angelleye/paypal-php-library/autoload.php'; /** * Setup configuration for the PayPal library using vars from the config file. * Then load the PayPal object into $PayPal */ $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); /** * Now we'll setup the request params for the final call in the Express Checkout flow. * This is very similar to SetExpressCheckout except that now we can include values * for the shipping, handling, and tax amounts, as well as the buyer's name and * shipping address that we obtained in the GetExpressCheckoutDetails step. * * If this information is not included in this final call, it will not be * available in PayPal's transaction details data. * * Once again, the template for DoExpressCheckoutPayment provides * many more params that are available, but we've stripped everything * we are not using in this basic demo out. */ $DECPFields = array('token' => $_SESSION['paypal_token'], 'payerid' => $_SESSION['paypal_payer_id']); /** * Just like with SetExpressCheckout, we need to gather our $Payment * data to pass into our $Payments array. This time we can include * the shipping, handling, tax, and shipping address details that we
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $SetAccessPermissionsFields = array('ReturnURL' => '', 'CancelURL' => '', 'LogoutURL' => '', 'LocalCode' => '', 'PageStyle' => '', 'HDRIMG' => '', 'HDRBorderColor' => '', 'HDRBackColor' => '', 'PayFlowColor' => '', 'InitFlowType' => '', 'FirstName' => '', 'LastName' => ''); $RequiredPermissions = array('Email', 'Name', 'GetBalance', 'RefundTransaction', 'GetTransactionDetails', 'TransactionSearch', 'MassPay', 'EncryptedWebsitePayments', 'GetExpressCheckoutDetails', 'SetExpressCheckout', 'DoExpressCheckoutPayment', 'DoCapture', 'DoAuthorization', 'DoReauthorization', 'DoVoid', 'DoDirectPayment', 'SetMobileCheckout', 'CreateMobileCheckout', 'DoMobileCheckoutPayment', 'DoUATPAuthorization', 'DoUATPExpressCheckoutPayment', 'GetBillingAgreementCustomerDetails', 'SetCustomerBillingAgreement', 'CreateBillingAgreement', 'BillAgreementUpdate', 'BillUser', 'DoReferenceTransaction', 'Express_Checkout', 'Admin_API', 'Auth_Settle', 'Transaction_History'); $OptionalPermissions = array('Email', 'Name', 'GetBalance', 'RefundTransaction', 'GetTransactionDetails', 'TransactionSearch', 'MassPay', 'EncryptedWebsitePayments', 'GetExpressCheckoutDetails', 'SetExpressCheckout', 'DoExpressCheckoutPayment', 'DoCapture', 'DoAuthorization', 'DoReauthorization', 'DoVoid', 'DoDirectPayment', 'SetMobileCheckout', 'CreateMobileCheckout', 'DoMobileCheckoutPayment', 'DoUATPAuthorization', 'DoUATPExpressCheckoutPayment', 'GetBillingAgreementCustomerDetails', 'SetCustomerBillingAgreement', 'CreateBillingAgreement', 'BillAgreementUpdate', 'BillUser', 'DoReferenceTransaction', 'Express_Checkout', 'Admin_API', 'Auth_Settle', 'Transaction_History'); $PayPalRequestData = array('SetAccessPermissionsFields' => $SetAccessPermissionsFields, 'RequiredPermissions' => $RequiredPermissions, 'OptionalPermissions' => $OptionalPermissions); $PayPalRequestData = array('SetAccessPermissionsFields' => $SetAccessPermissionsFields, 'RequiredPermissions' => $RequiredPermissions, 'OptionalPermissions' => $OptionalPermissions); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->SetAccessPermissions($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $DRFields = array('authorizationid' => '', 'amt' => '', 'currencycode' => '', 'msgsubid' => ''); $PayPalRequestData = array('DRFields' => $DRFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->DoReauthorization($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $GTDFields = array('transactionid' => '3WN902700D272342K'); $PayPalRequestData = array('GTDFields' => $GTDFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetTransactionDetails($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $UAFields = array('transactionid' => '3WN902700D272342K', 'ipaddress' => $_SERVER['REMOTE_ADDR']); $PayPalRequestData = array('UAFields' => $UAFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->UpdateAuthorization($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $Token = ''; $PayPalResult = $PayPal->GetExpressCheckoutDetails($Token); $PhoneNumber = $PayPalResult['PHONENUM']; // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php /** * Include our config file and the PayPal library. */ require_once '../../includes/config.php'; require_once '../../vendor/angelleye/paypal-php-library/autoload.php'; /** * Setup configuration for the PayPal library using vars from the config file. * Then load the PayPal object into $PayPal */ $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); /** * Here we are setting up the parameters for a basic Express Checkout flow. * * The template provided at /vendor/angelleye/paypal-php-library/templates/SetExpressCheckout.php * contains a lot more parameters that we aren't using here, so I've removed them to keep this clean. * * $domain used here is set in the config file. * * For Digital Goods, we know that we will not need to calculate * shipping. As such, we will not need our additional review * page that we've been using in our other Express Checkout demos. * Therefore, we have added the "skipdetails" parameter here set to a 1 * to enable it. * * This way, we can skip over the final review and go straight to * DoExpressCheckoutPayment, which you'll see by following the flow. */ $SECFields = array('maxamt' => round($_SESSION['shopping_cart']['grand_total'] * 2, 2), 'returnurl' => $domain . 'demo/express-checkout-digital-goods/GetExpressCheckoutDetails.php', 'cancelurl' => $domain . 'demo/express-checkout-digital-goods/cancel.php', 'hdrimg' => 'https://www.angelleye.com/images/angelleye-paypal-header-750x90.jpg', 'logoimg' => 'https://www.angelleye.com/images/angelleye-logo-190x60.jpg', 'brandname' => 'Angell EYE', 'customerservicenumber' => '816-555-5555', 'skipdetails' => '1');
<?php /** * Include our config file and the PayPal library. */ require_once '../../includes/config.php'; require_once '../../vendor/angelleye/paypal-php-library/autoload.php'; /** * Setup configuration for the PayPal library using vars from the config file. * Then load the PayPal object into $PayPal */ $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); /** * Now we pass the PayPal token that we saved to a session variable * in the SetExpressCheckout.php file into the GetExpressCheckoutDetails * request. */ $PayPalResult = $PayPal->GetExpressCheckoutDetails($_SESSION['paypal_token']); /** * Now we'll check for any errors returned by PayPal, and if we get an error, * we'll save the error details to a session and redirect the user to an * error page to display it accordingly. * * If the call is successful, we'll save some data we might want to use * later into session variables. */ if ($PayPal->APICallSuccessful($PayPalResult['ACK'])) { /** * Here we'll pull out data from the PayPal response. * Refer to the PayPal API Reference for all of the variables available
<?php require_once '../includes/config.php'; require_once '../autoload.php'; $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); /* * Here we call GetExpressCheckoutDetails to obtain payer information from PayPal */ $GECDResult = $PayPal->GetExpressCheckoutDetails($_SESSION['SetExpressCheckoutResult']['TOKEN']); $GECDResult_Payments = $PayPal->GetPayments($GECDResult); foreach ($GECDResult_Payments as $Payment) { // Gather required data for this payment. $_SESSION['ShipToName'] = isset($Payment['SHIPTONAME']) ? $Payment['SHIPTONAME'] : ''; $_SESSION['ShipToStreet'] = isset($Payment['SHIPTOSTREET']) ? $Payment['SHIPTOSTREET'] : ''; $_SESSION['ShipToStreet2'] = isset($Payment['SHIPTOSTREET2']) ? $Payment['SHIPTOSTREET2'] : ''; $_SESSION['ShipToCity'] = isset($Payment['SHIPTOCITY']) ? $Payment['SHIPTOCITY'] : ''; $_SESSION['ShipToState'] = isset($Payment['SHIPTOSTATE']) ? $Payment['SHIPTOSTATE'] : ''; if (strlen($_SESSION['ShipToState']) > 2) { $_SESSION['ShipToState'] = $PayPal->GetStateCode($_SESSION['ShipToState']); } $_SESSION['ShipToPostalCode'] = isset($Payment['SHIPTOZIP']) ? $Payment['SHIPTOZIP'] : ''; $_SESSION['ShipToCountryCode'] = isset($Payment['SHIPTOCOUNTRYCODE']) ? $Payment['SHIPTOCOUNTRYCODE'] : ''; $_SESSION['ShipToCountryName'] = isset($Payment['SHIPTOCOUNTRYNAME']) ? $Payment['SHIPTOCOUNTRYNAME'] : ''; $_SESSION['ShipToPhoneNumber'] = isset($Payment['SHIPTOPHONENUM']) ? $Payment['SHIPTOPHONENUM'] : ''; $_SESSION['ShipToAddressStatus'] = isset($Payment['ADDRESSSTATUS']) ? $Payment['ADDRESSSTATUS'] : ''; $_SESSION['CustomerNotes'] = isset($Payment['NOTETEXT']) ? $Payment['NOTETEXT'] : ''; if ($_SESSION['ShipToCountryCode'] != 'US' && $_SESSION['ShipToState'] == '') { $_SESSION['ShipToState'] = $_SESSION['ShipToCountryCode']; } }
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetPalDetails(); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $BMButtonSearchFields = array('startdate' => '', 'enddate' => ''); $PayPalRequestData = array('BMButtonSearchFields' => $BMButtonSearchFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->BMButtonSearch($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $MPFields = array('emailsubject' => '', 'currencycode' => '', 'receivertype' => ''); // Typically, you'll loop through some sort of records to build your MPItems array. // Here I simply include 3 items individually. $Item1 = array('l_email' => '', 'l_receiverid' => '', 'l_amt' => '', 'l_uniqueid' => '', 'l_note' => ''); $Item2 = array('l_email' => '', 'l_receiverid' => '', 'l_amt' => '', 'l_uniqueid' => '', 'l_note' => ''); $Item3 = array('l_email' => '', 'l_receiverid' => '', 'l_amt' => '', 'l_uniqueid' => '', 'l_note' => ''); $MPItems = array($Item1, $Item2, $Item3); // etc $PayPalRequestData = array('MPFields' => $MPFields, 'MPItems' => $MPItems); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->MassPay($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../autoload.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'PrintHeaders' => $print_headers, 'LogResults' => $log_results, 'LogPath' => $log_path); $PayPal = new angelleye\PayPal\PayPal($PayPalConfig); // Prepare request arrays $DECPFields = array('token' => '', 'payerid' => '', 'returnfmfdetails' => '', 'giftmessage' => '', 'giftreceiptenable' => '', 'giftwrapname' => '', 'giftwrapamount' => '', 'buyermarketingemail' => '', 'skipbacreation' => '', 'usesessionpaymentdetails' => '', 'surveyquestion' => '', 'surveychoiceselected' => '', 'allowedpaymentmethod' => ''); $Payments = array(); $Payment = array('amt' => '', 'bucketcategorytype' => '', 'currencycode' => '', 'itemamt' => '', 'shippingamt' => '', 'shippingdiscamt' => '', 'insuranceoptionoffered' => '', 'handlingamt' => '', 'taxamt' => '', 'desc' => '', 'custom' => '', 'invnum' => '', 'notifyurl' => '', 'shiptoname' => '', 'shiptostreet' => '', 'shiptostreet2' => '', 'shiptocity' => '', 'shiptostate' => '', 'shiptozip' => '', 'shiptocountrycode' => '', 'shiptophonenum' => '', 'notetext' => '', 'allowedpaymentmethod' => '', 'paymentaction' => '', 'paymentrequestid' => '', 'sellerpaypalaccountid' => '', 'sellerid' => '', 'sellerusername' => '', 'sellerregistrationdate' => '', 'softdescriptor' => ''); $PaymentOrderItems = array(); $Item = array('name' => '', 'desc' => '', 'amt' => '', 'number' => '', 'qty' => '', 'taxamt' => '', 'itemurl' => '', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => ''); array_push($PaymentOrderItems, $Item); $Payment['order_items'] = $PaymentOrderItems; array_push($Payments, $Payment); $UserSelectedOptions = array('shippingcalculationmode' => '', 'insuranceoptionselected' => '', 'shippingoptionisdefault' => '', 'shippingoptionamount' => '', 'shippingoptionname' => ''); $PayPalRequestData = array('DECPFields' => $DECPFields, 'Payments' => $Payments, 'UserSelectedOptions' => $UserSelectedOptions); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->DoExpressCheckoutPayment($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);