public function execute() { // Create PayPal object. $PayPalConfig = array('Sandbox' => $this->sandbox, 'DeveloperAccountEmail' => $this->developer_account_email, 'ApplicationID' => $this->application_id, 'DeviceID' => $this->device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $this->api_username, 'APIPassword' => $this->api_password, 'APISignature' => $this->api_signature, 'APISubject' => $this->api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $ExecutePaymentFields = array('PayKey' => '', 'FundingPlanID' => ''); $PayPalRequestData = array('ExecutePaymentFields' => $ExecutePaymentFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->ExecutePayment($PayPalRequestData); return $PayPalResult; }
function makepayment($paymentDetails = NULL) { $PayPal = new PayPal_Adaptive($this->PayPalConfig); $Receivers = array(); // Prepare request arrays // pr($this->PayPalConfig); $this->PayRequestFields = array('ActionType' => 'CREATE', 'CancelURL' => $this->cancelurl, 'CurrencyCode' => 'USD', 'FeesPayer' => 'PRIMARYRECEIVER', 'IPNNotificationURL' => $this->notifyurl, 'Memo' => '', 'Pin' => '', 'PreapprovalKey' => '', 'ReturnURL' => $this->returnurl, 'ReverseAllParallelPaymentsOnError' => 'TRUE', 'SenderEmail' => '', 'TrackingID' => ''); foreach ($paymentDetails as $paymentDetail) { $Receiver = array('Amount' => $paymentDetail['amount'], 'Email' => $paymentDetail['paypalemail'], 'InvoiceID' => '', 'PaymentType' => '', 'PaymentSubType' => '', 'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), 'Primary' => $paymentDetail['status']); array_push($Receivers, $Receiver); } //pr($Receivers); $SenderIdentifierFields = array('UseCredentials' => ''); $AccountIdentifierFields = array('Email' => '', 'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '')); $PayPalRequestData = array('PayRequestFields' => $this->PayRequestFields, 'ClientDetailsFields' => $this->ClientDetailsFields, 'Receivers' => $Receivers, 'SenderIdentifierFields' => $this->SenderIdentifierFields, 'AccountIdentifierFields' => $this->AccountIdentifierFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->Pay($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. //echo '<pre />'; //print_r($PayPalResult); return $PayPalResult; }
<?php // Include required library files. require_once '../includes/config.php'; require_once '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $GetShippingAddressesFields = array('Key' => ''); $PayPalRequestData = array('GetShippingAddressesFields' => $GetShippingAddressesFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetShippingAddresses($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $SPOFields = array('PayKey' => '', 'ShippingAddressID' => ''); $DisplayOptions = array('EmailHeaderImageURL' => '', 'EmailMarketingImageURL' => '', 'HeaderImageURL' => '', 'BusinessName' => ''); $InstitutionCustomer = array('CountryCode' => '', 'DisplayName' => '', 'InstitutionCustomerEmail' => '', 'FirstName' => '', 'LastName' => '', 'InstitutionCustomerID' => '', 'InstitutionID' => ''); $SenderOptions = array('RequireShippingAddressSelection' => ''); // Begin loop to populate receiver options. $ReceiverOptions = array(); $ReceiverOption = array('Description' => '', 'CustomID' => ''); $InvoiceData = array('TotalTax' => '', 'TotalShipping' => ''); $InvoiceItems = array(); $InvoiceItem = array('Name' => '', 'Identifier' => '', 'Price' => '', 'ItemPrice' => '', 'ItemCount' => ''); array_push($InvoiceItems, $InvoiceItem); $ReceiverIdentifier = array('Email' => '', 'PhoneCountryCode' => '', 'PhoneNumber' => '', 'PhoneExtension' => ''); $ReceiverOption['InvoiceData'] = $InvoiceData; $ReceiverOption['InvoiceItems'] = $InvoiceItems; $ReceiverOption['ReceiverIdentifier'] = $ReceiverIdentifier; array_push($ReceiverOptions, $ReceiverOption); // End receiver options loop $PayPalRequestData = array('SPOFields' => $SPOFields, 'DisplayOptions' => $DisplayOptions, 'InstitutionCustomer' => $InstitutionCustomer, 'SenderOptions' => $SenderOptions, 'ReceiverOptions' => $ReceiverOptions); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->SetPaymentOptions($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $PreapprovalDetailsFields = array('GetBillingAddress' => '', 'PreapprovalKey' => 'PA-5P328399AE5680849'); $PayPalRequestData = array('PreapprovalDetailsFields' => $PreapprovalDetailsFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->PreapprovalDetails($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $CancelInvoiceFields = array('InvoiceID' => '', 'Subject' => '', 'NoteForPayer' => '', 'SendCopyToMerchant' => ''); $PayPalRequestData = array('CancelInvoiceFields' => $CancelInvoiceFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->CancelInvoice($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $PaymentDetailsFields = array('PayKey' => '', 'TransactionID' => '', 'TrackingID' => ''); $PayPalRequestData = array('PaymentDetailsFields' => $PaymentDetailsFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->PaymentDetails($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $SearchInvoicesFields = array('MerchantEmail' => '', 'Page' => '', 'PageSize' => ''); $Parameters = array('Email' => '', 'RecipientName' => '', 'BusinessName' => '', 'InvoiceNumber' => '', 'Status' => '', 'LowerAmount' => '', 'UpperAmount' => '', 'CurrencyCode' => '', 'Memo' => '', 'Origin' => '', 'InvoiceDate' => array('StartDate' => '', 'EndDate' => ''), 'DueDate' => array('StartDate' => '', 'EndDate' => ''), 'PaymentDate' => array('StartDate' => '', 'EndDate' => ''), 'CreationDate' => array('StartDate' => '', 'EndDate' => '')); $PayPalRequestData = array('SearchInvoicesFields' => $SearchInvoicesFields, 'Parameters' => $Parameters); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->SearchInvoices($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $Token = ''; $PayPalResult = $PayPal->GetPermissions($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; $crovallpay = mysql_query("SELECT * FROM crowed_payment WHERE order_status='processing'"); // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); while ($crovallpayy = mysql_fetch_array($crovallpay)) { /*echo '<pre>'; print_r($crovallpayy);*/ $cvhb = ''; $opd = explode(',', $crovallpayy['prod_id']); foreach ($opd as $pronarg) { ///Email $buyeremail = mysql_fetch_array(mysql_query("SELECT user_email FROM wp_users WHERE ID=" . $crovallpayy['user_id'])); $orproduct_totqty = mysql_fetch_array(mysql_query("SELECT sum(b.meta_value) as tot_prod_qty FROM wp_woocommerce_order_itemmeta as a, wp_woocommerce_order_itemmeta as b WHERE a.meta_value=" . $pronarg . " AND a.meta_key='_product_id' AND a.order_item_id=b.order_item_id AND b.meta_key='_qty'")); $popqty = $orproduct_totqty['tot_prod_qty']; $prostk = mysql_fetch_array(mysql_query("SELECT meta_value FROM wp_postmeta WHERE meta_key='_stock' AND post_id=" . $pronarg)); if ($prostk['meta_value'] <= $popqty) { } else { $cvhb = 'notyet'; } } if (isset($cvhb) && $cvhb != 'notyet') { mail($buyeremail['user_email'], 'dfsd', 'sdfd'); mail('*****@*****.**', 'profit', 'sdfd'); // Prepare request arrays $PayRequestFields = array('ActionType' => 'PAY', 'CancelURL' => 'http://maestros-ites.com/testserver1/teecircle/paypal/blank.php', 'CurrencyCode' => 'USD', 'FeesPayer' => '', 'IPNNotificationURL' => '', 'Memo' => '', 'Pin' => '', 'PreapprovalKey' => $crovallpayy['preapprovalkey'], 'ReturnURL' => 'http://maestros-ites.com/testserver1/teecircle/paypal/blank.php', 'ReverseAllParallelPaymentsOnError' => '', 'SenderEmail' => '', 'TrackingID' => '');
<?php // Include required library files. require_once '../includes/config.php'; require_once '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $InvoiceID = ''; // Required. Invoice ID of the invoice to send. $PayPalResult = $PayPal->SendInvoice($InvoiceID); // 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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Pay $PayRequestFields = array('ActionType' => '', 'CancelURL' => '', 'CurrencyCode' => '', 'FeesPayer' => '', 'IPNNotificationURL' => '', 'Memo' => '', 'Pin' => '', 'PreapprovalKey' => '', 'ReturnURL' => '', 'ReverseAllParallelPaymentsOnError' => '', 'SenderEmail' => '', 'TrackingID' => ''); $ClientDetailsFields = array('CustomerID' => '', 'CustomerType' => '', 'GeoLocation' => '', 'Model' => '', 'PartnerName' => ''); $FundingTypes = array('ECHECK', 'BALANCE', 'CREDITCARD'); // Funding constrainigs require advanced permissions levels. $Receivers = array(); $Receiver = array('Amount' => '', 'Email' => '', 'InvoiceID' => '', 'PaymentType' => '', 'PaymentSubType' => '', 'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), 'Primary' => ''); array_push($Receivers, $Receiver); $SenderIdentifierFields = array('UseCredentials' => ''); $AccountIdentifierFields = array('Email' => '', 'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '')); // SetPaymentOptions $SPOFields = array('PayKey' => '', 'ShippingAddressID' => ''); $DisplayOptions = array('EmailHeaderImageURL' => '', 'EmailMarketingImageURL' => '', 'HeaderImageURL' => '', 'BusinessName' => ''); $InstitutionCustomer = array('CountryCode' => '', 'DisplayName' => '', 'InstitutionCustomerEmail' => '', 'FirstName' => '', 'LastName' => '', 'InstitutionCustomerID' => '', 'InstitutionID' => ''); $SenderOptions = array('RequireShippingAddressSelection' => ''); // Begin loop to populate receiver options. $ReceiverOptions = array(); $ReceiverOption = array('Description' => '', 'CustomID' => ''); $InvoiceData = array('TotalTax' => '', 'TotalShipping' => ''); $InvoiceItems = array(); $InvoiceItem = array('Name' => '', 'Identifier' => '', 'Price' => '', 'ItemPrice' => '', 'ItemCount' => ''); array_push($InvoiceItems, $InvoiceItem);
<?php // Include required library files. require_once '../includes/config.php'; require_once '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $CancelPreapprovalFields = array('PreapprovalKey' => ''); $PayPalRequestData = array('CancelPreapprovalFields' => $CancelPreapprovalFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->CancelPreapproval($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
function cancel_preapprovals($sel_backing) { // $sel_backing is preapproved backing record to be cancelled // use old sdk global $PayPalConfig; $PayPal = new PayPal_Adaptive($PayPalConfig); $DataArray = array(); $CancelPreapprovalFields = array('PreapprovalKey' => $sel_backing['preapproval_key']); $DataArray['CancelPreapprovalFields'] = $CancelPreapprovalFields; $PayPalResult = $PayPal->CancelPreapproval($DataArray); // $PayPalResult array( // 'Errors' => $Errors, // 'Ack' => $Ack, // 'Build' => $Build, // 'CorrelationID' => $CorrelationID, // 'Timestamp' => $Timestamp, // 'XMLRequest' => $XMLRequest, // 'XMLResponse' => $XMLResponse // } wrtlog("DEBUG in cancel_preapprovals PayPalResult: " . print_r($PayPalResult, true)); if (strtolower($PayPalResult['Ack']) == 'success') { $this->cancel_preapprovals_backer_dbupdate($sel_backing, $PayPalResult); $this->cancel_preapprovals_backer_mail($sel_backing, $PayPalResult); } else { wrtlog("WARNING: project #{$sel_backing['projectId']} backing #{$sel_backing['backingId']} could not be cancelled: " . print_r($PayPalResult, true)); $this->cancel_preapprovals_backer_dbupdate($sel_backing, $PayPalResult); // still mark it cancelled // at this point - we are silent on outcome to the backer... tbd } }
<?php // Include required library files. require_once '../includes/config.php'; require_once '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $UpdateInvoiceFields = array('InvoiceID' => '', 'MerchantEmail' => '', 'PayerEmail' => '', 'Number' => '', 'CurrencyCode' => '', 'InvoiceDate' => '', 'DueDate' => '', 'PaymentTerms' => '', 'DiscountPercent' => '', 'DiscountAmount' => '', 'Terms' => '', 'Note' => '', 'MerchantMemo' => '', 'ShippingAmount' => '', 'ShippingTaxName' => '', 'ShippingTaxRate' => '', 'LogoURL' => ''); $BusinessInfo = array('FirstName' => '', 'LastName' => '', 'BusinessName' => '', 'Phone' => '', 'Fax' => '', 'Website' => '', 'Custom' => ''); $BusinessInfoAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $BillingInfo = array('FirstName' => '', 'LastName' => '', 'BusinessName' => '', 'Phone' => '', 'Fax' => '', 'Website' => '', 'Custom' => ''); $BillingInfoAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $ShippingInfo = array('FirstName' => '', 'LastName' => '', 'BusinessName' => '', 'Phone' => '', 'Fax' => '', 'Website' => '', 'Custom' => ''); $ShippingInfoAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); // For invoice items you populate a nested array with multiple $InvoiceItem arrays. Normally you'll be looping through cart items to populate the $InvoiceItem // array and then push it into the $InvoiceItems array at the end of each loop for an entire collection of all items in $InvoiceItems. $InvoiceItems = array(); $InvoiceItem = array('Name' => '', 'Description' => '', 'Date' => '', 'Quantity' => '', 'UnitPrice' => '', 'TaxName' => '', 'TaxRate' => ''); array_push($InvoiceItems, $InvoiceItem); $PayPalRequestData = array('UpdateInvoiceFields' => $UpdateInvoiceFields, 'BusinessInfo' => $BusinessInfo, 'BusinessInfoAddress' => $BusinessInfoAddress, 'BillingInfo' => $BillingInfo, 'BillingInfoAddress' => $BillingInfoAddress, 'ShippingInfo' => $ShippingInfo, 'ShippingInfoAddress' => $ShippingInfoAddress, 'InvoiceItems' => $InvoiceItems); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->UpdateInvoice($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $Scope = array('EXPRESS_CHECKOUT', 'DIRECT_PAYMENT', 'SETTLEMENT_CONSOLIDATION', 'SETTLEMENT_REPORTING', 'AUTH_CAPTURE', 'MOBILE_CHECKOUT', 'BILLING_AGREEMENT', 'REFERENCE_TRANSACTION', 'AIR_TRAVEL', 'MASS_PAY', 'TRANSACTION_DETAILS', 'TRANSACTION_SEARCH', 'RECURRING_PAYMENTS', 'ACCOUNT_BALANCE', 'ENCRYPTED_WEBSITE_PAYMENTS', 'REFUND', 'NON_REFERENCED_CREDIT', 'BUTTON_MANAGER', 'MANAGE_PENDING_TRANSACTION_STATUS', 'RECURRING_PAYMENT_REPORT', 'EXTENDED_PRO_PROCESSING_REPORT', 'EXCEPTION_PROCESSING_REPORT', 'ACCOUNT_MANAGEMENT_PERMISSIONS', 'ACCESS_BASIC_PERSONAL_DATA', 'ACCESS_ADVANCED_PERSONAL_DATA'); $RequestPermissionsFields = array('Scope' => $Scope, 'Callback' => ''); $PayPalRequestData = array('RequestPermissionsFields' => $RequestPermissionsFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->RequestPermissions($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $GetAccessTokenFields = array('Token' => '', 'Verifier' => ''); $PayPalRequestData = array('GetAccessTokenFields' => $GetAccessTokenFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetAccessToken($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $BaseAmountList = array(); $BaseAmountData = array('Code' => '', 'Amount' => ''); array_push($BaseAmountList, $BaseAmountData); $ConvertToCurrencyList = array('USD', 'AUD', 'CAD'); // Currency Codes $PayPalRequestData = array('BaseAmountList' => $BaseAmountList, 'ConvertToCurrencyList' => $ConvertToCurrencyList); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->ConvertCurrency($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $CreateInvoiceFields = array('MerchantEmail' => '', 'PayerEmail' => '', 'Number' => '', 'CurrencyCode' => '', 'InvoiceDate' => '', 'DueDate' => '', 'PaymentTerms' => '', 'DiscountPercent' => '', 'DiscountAmount' => '', 'Terms' => '', 'Note' => '', 'MerchantMemo' => '', 'ShippingAmount' => '', 'ShippingTaxName' => '', 'ShippingTaxRate' => '', 'LogoURL' => ''); $BusinessInfo = array('FirstName' => '', 'LastName' => '', 'BusinessName' => '', 'Phone' => '', 'Fax' => '', 'Website' => '', 'Custom' => ''); $BusinessInfoAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $BillingInfo = array('FirstName' => '', 'LastName' => '', 'BusinessName' => '', 'Phone' => '', 'Fax' => '', 'Website' => '', 'Custom' => ''); $BillingInfoAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $ShippingInfo = array('FirstName' => '', 'LastName' => '', 'BusinessName' => '', 'Phone' => '', 'Fax' => '', 'Website' => '', 'Custom' => ''); $ShippingInfoAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); // For invoice items you populate a nested array with multiple $InvoiceItem arrays. Normally you'll be looping through cart items to populate the $InvoiceItem // array and then push it into the $InvoiceItems array at the end of each loop for an entire collection of all items in $InvoiceItems. $InvoiceItems = array(); $InvoiceItem = array('Name' => '', 'Description' => '', 'Date' => '', 'Quantity' => '', 'UnitPrice' => '', 'TaxName' => '', 'TaxRate' => ''); array_push($InvoiceItems, $InvoiceItem); $PayPalRequestData = array('CreateInvoiceFields' => $CreateInvoiceFields, 'BusinessInfo' => $BusinessInfo, 'BusinessInfoAddress' => $BusinessInfoAddress, 'BillingInfo' => $BillingInfo, 'BillingInfoAddress' => $BillingInfoAddress, 'ShippingInfo' => $ShippingInfo, 'ShippingInfoAddress' => $ShippingInfoAddress, 'InvoiceItems' => $InvoiceItems); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->CreateInvoice($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; /*print_r($_SESSION);*/ // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $PreapprovalFields = array('CancelURL' => 'http://maestros-ites.com/testserver1/teecircle/paypal/cancel.php', 'CurrencyCode' => 'USD', 'DateOfMonth' => '', 'DayOfWeek' => '', 'EndingDate' => '', 'IPNNotificationURL' => '', 'MaxAmountPerPayment' => '', 'MaxNumberOfPayments' => '', 'MaxTotalAmountOfPaymentsPerPeriod' => '', 'MaxTotalAmountOfAllPayments' => $_SESSION['MaxTotalAmountOfAllPayments'], 'Memo' => '', 'PaymentPeriod' => '', 'PinType' => '', 'ReturnURL' => 'http://maestros-ites.com/testserver1/teecircle/paypal/return.php', 'SenderEmail' => '', 'StartingDate' => date('Y-m-d'), 'FeesPayer' => '', 'DisplayMaxTotalAmount' => 'true'); $ClientDetailsFields = array('CustomerID' => '', 'CustomerType' => '', 'GeoLocation' => '', 'Model' => '', 'PartnerName' => ''); $PayPalRequestData = array('PreapprovalFields' => $PreapprovalFields, 'ClientDetailsFields' => $ClientDetailsFields); /*echo '<pre>';print_r($PreapprovalFields);die();*/ // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->Preapproval($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. /*echo '<pre />'; print_r($PayPalResult);*/ if ($PayPalResult['Ack'] == 'Success') { $croval = mysql_fetch_array(mysql_query("SELECT id FROM crowed_payment WHERE order_id=" . $_SESSION['order_id'] . " AND \r\r\n\t \t\t\t\t\t\t\t\t prod_id='" . $_SESSION['prodids'] . "' AND \r\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t user_id='" . $_SESSION['user_id'] . "'")); if (isset($croval['id']) && !empty($croval['id'])) { mysql_query("UPDATE crowed_payment SET order_date='" . date('Y-m-d') . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t order_amount='" . $_SESSION['MaxTotalAmountOfAllPayments'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t preapprovalkey='" . $PayPalResult['PreapprovalKey'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t correlationid='" . $PayPalResult['CorrelationID'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t order_status='pending' WHERE id=" . $croval['id']); } else { mysql_query("INSERT INTO crowed_payment SET order_id=" . $_SESSION['order_id'] . ",\r\r\n\t prod_id='" . $_SESSION['prodids'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t\torder_date='" . date('Y-m-d') . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t\torder_amount='" . $_SESSION['MaxTotalAmountOfAllPayments'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t\tpreapprovalkey='" . $PayPalResult['PreapprovalKey'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t\tcorrelationid='" . $PayPalResult['CorrelationID'] . "',\r\r\n\t\t\t\t\t\t\t\t\t\t\t\torder_status='pending',\r\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_id='" . $_SESSION['user_id'] . "'"); } $crovall = mysql_fetch_array(mysql_query("SELECT id FROM crowed_payment WHERE order_id=" . $_SESSION['order_id'] . " AND \r\r\n\t \t\t\t\t\t\t\t\t prod_id='" . $_SESSION['prodids'] . "' AND\r\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t preapprovalkey='" . $PayPalResult['PreapprovalKey'] . "' AND \r\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t user_id='" . $_SESSION['user_id'] . "'")); $_SESSION['orid'] = $crovall['id']; header('location:' . $PayPalResult['RedirectURL']); die;
<?php // Include required library files. require_once '../includes/config.php'; require_once '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $Token = ''; $PayPalResult = $PayPal->CancelPermissions($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $AttributeList = array('http://axschema.org/namePerson/first', 'http://axschema.org/namePerson/last', 'http://axschema.org/contact/email', 'http://axschema.org/contact/fullname', 'http://openid.net/schema/company/name', 'http://axschema.org/contact/country/home', 'https://www.paypal.com/webapps/auth/schema/payerID'); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetBasicPersonalData($AttributeList); // 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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $ExecutePaymentFields = array('PayKey' => '', 'FundingPlanID' => ''); $PayPalRequestData = array('ExecutePaymentFields' => $ExecutePaymentFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->ExecutePayment($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $CreateAccountFields = array('AccountType' => '', 'CitizenshipCountryCode' => '', 'ContactPhoneNumber' => '', 'HomePhoneNumber' => '', 'MobilePhoneNumber' => '', 'ReturnURL' => '', 'ShowAddCreditCard' => '', 'ShowMobileConfirm' => '', 'ReturnURLDescription' => '', 'UseMiniBrowser' => '', 'CurrencyCode' => '', 'DateOfBirth' => '', 'EmailAddress' => '', 'Saluation' => '', 'FirstName' => '', 'MiddleName' => '', 'LastName' => '', 'Suffix' => '', 'NotificationURL' => '', 'PreferredLanguageCode' => '', 'RegistrationType' => '', 'SuppressWelcomeEmail' => '', 'PerformExtraVettingOnThisAccount' => '', 'TaxID' => ''); $BusinessInfo = array('AverageMonthlyVolume' => '', 'AveragePrice' => '', 'BusinessName' => '', 'BusinessSubType' => '', 'BusinessType' => '', 'Category' => '', 'CommercialRegistrationLocation' => '', 'CompanyID' => '', 'CustomerServiceEmail' => '', 'CustomerServicePhone' => '', 'DateOfEstablishment' => '', 'DisputeEmail' => '', 'DoingBusinessAs' => '', 'EstablishmentCountryCode' => '', 'EstablishmentState' => '', 'IncorporationID' => '', 'MerchantCategoryCode' => '', 'PercentageRevenueFromOnline' => '', 'SalesVenu' => '', 'SalesVenuDesc' => '', 'SubCategory' => '', 'VatCountryCode' => '', 'VatID' => '', 'WebSite' => '', 'WorkPhone' => ''); $BusinessAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $PrinciplePlaceOfBusinessAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $RegisteredOfficeAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $BusinessStakeHolder = array('DateOfBirth' => '', 'FullLegalName' => '', 'Saluation' => '', 'FirstName' => '', 'MiddleName' => '', 'LastName' => '', 'Suffix' => '', 'Role' => '', 'CountryCode' => ''); $BusinessStakeHolderAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $Address = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $PartnerFields = array('Field1' => '', 'Field2' => '', 'Field3' => '', 'Field4' => '', 'Field5' => ''); $PayPalRequestData = array('CreateAccountFields' => $CreateAccountFields, 'BusinessInfo' => $BusinessInfo, 'BusinessAddress' => $BusinessAddress, 'PrinciplePlaceOfBusinessAddress' => $PrinciplePlaceOfBusinessAddress, 'RegisteredOfficeAddress' => $RegisteredOfficeAddress, 'BusinessStakeHolder' => $BusinessStakeHolder, 'BusinessStakeHolderAddress' => $BusinessStakeHolderAddress, 'Address' => $Address, 'PartnerFields' => $PartnerFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->CreateAccount($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $AttributeList = array('http://axschema.org/birthDate', 'http://axschema.org/contact/postalCode/home', 'http://schema.openid.net/contact/street1', 'http://schema.openid.net/contact/street2', 'http://axschema.org/contact/city/home', 'http://axschema.org/contact/state/home', 'http://axschema.org/contact/phone/default'); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetAdvancedPersonalData($AttributeList); // 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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $GetFundingPlansFields = array('PayKey' => ''); $PayPalRequestData = array('GetFundingPlansFields' => $GetFundingPlansFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetFundingPlans($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $AddPaymentCardFields = array('AccountID' => '', 'CardNumber' => '', 'CardOwnerDateOfBirth' => '', 'CardType' => '', 'CardVerificationNumber' => '', 'ConfirmationType' => '', 'CreateAccountKey' => '', 'EmailAddress' => '', 'IssueNumber' => '', 'StartDate' => ''); $NameOnCard = array('Salutation' => '', 'FirstName' => '', 'MiddleName' => '', 'LastName' => '', 'Suffix' => ''); $BillingAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => ''); $ExpirationDate = array('Month' => '', 'Year' => ''); $WebOptions = array('CancelURL' => '', 'CancelURLDescription' => '', 'ReturnURL' => '', 'ReturnURLDescription' => ''); $PayPalRequestData = array('AddPaymentCardFields' => $AddPaymentCardFields, 'NameOnCard' => $NameOnCard, 'BillingAddress' => $BillingAddress, 'ExpirationDate' => $ExpirationDate, 'WebOptions' => $WebOptions); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->AddPaymentCard($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $RefundFields = array('CurrencyCode' => '', 'PayKey' => '', 'TransactionID' => '', 'TrackingID' => ''); $Receivers = array(); $Receiver = array('Email' => '', 'Amount' => '', 'Primary' => '', 'InvoiceID' => '', 'PaymentType' => ''); array_push($Receivers, $Receiver); $PayPalRequestData = array('RefundFields' => $RefundFields, 'Receivers' => $Receivers); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->Refund($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 '../includes/paypal.class.php'; require_once '../includes/paypal.adaptive.class.php'; // Create PayPal object. $PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject); $PayPal = new PayPal_Adaptive($PayPalConfig); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $InvoiceID = ''; $PayPalResult = $PayPal->GetInvoiceDetails($InvoiceID); // Write the contents of the response array to the screen for demo purposes. echo '<pre />'; print_r($PayPalResult);
// Prepare request arrays $GetVerifiedStatusFields = array('EmailAddress' => $_POST['paypalemail'], 'FirstName' => $_POST['paypalfname'], 'LastName' => $_POST['paypallname'], 'MatchCriteria' => 'NAME'); $PayPalRequestData = array('GetVerifiedStatusFields' => $GetVerifiedStatusFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalResult = $PayPal->GetVerifiedStatus($PayPalRequestData); // Write the contents of the response array to the screen for demo purposes. /*echo '<pre />'; print_r($PayPalResult); echo $PayPalResult['AccountStatus'];*/ if ($PayPalResult['AccountStatus'] == "VERIFIED") { $paypalemail = base64_encode($_POST['paypalemail']); $paypalFname = $_POST['paypalfname']; $paypalLname = $_POST['paypallname']; $con->update("UPDATE users SET paypalUserAccount='{$paypalemail}', paypalFname='{$paypalFname}', paypalLname='{$paypalLname}'\n\t\t\t\tWHERE `userId` = '" . $_SESSION['userId'] . "'"); /****** Paypal Adaptive REFUND permission code *******/ $PayPal = new PayPal_Adaptive($PayPalConfig); // Prepare request arrays $Scope = array('REFUND'); $RequestPermissionsFields = array('Scope' => $Scope, 'Callback' => $base_url . 'profile/edit/'); //print_r($RequestPermissionsFields); $PayPalRequestData = array('RequestPermissionsFields' => $RequestPermissionsFields); // Pass data into class for processing with PayPal and load the response array into $PayPalResult $PayPalPer = $PayPal->RequestPermissions($PayPalRequestData); $_SESSION['msgType'] = array('from' => 'user', 'type' => 'error', 'var' => "multiple", 'val' => "Your Paypal Account is Added Successfuly"); redirect($PayPalPer['RedirectURL']); //redirect($base_url."profile/edit/"); } else { $_SESSION['msgType'] = array('from' => 'user', 'type' => 'error', 'var' => "multiple", 'val' => "Problem Verifying your Paypal Business Account, Please Try Again"); redirect($base_url . "profile/edit/"); } }