How to make Paypal Recurring system for any site.


Hello every one today i am going to tell you how to make paypal recurring method for any site you can easily iterated this method to any website.


<?php
require_once "class.paypal.recurring.php";

if(isset($_POST['formsubmit'])) :
echo '<pre>';
print_r($_POST);
echo '</pre>';
endif;

$obj = new paypal_recurring();

$obj->environment = 'sandbox'; // or 'beta-sandbox' or 'live'
$obj->paymentType = urlencode('Authorization'); // or 'Sale' or 'Order'

// Set request-specific fields.
$obj->creditCardType = urlencode('Visa');
$obj->creditCardNumber = urlencode('4316666651546961');
$obj->padDateMonth = urlencode('3');
$obj->expDateYear = urlencode('2019');
$obj->cvv2Number = urlencode('123');
$obj->firstName = urlencode('Harpreet');
$obj->lastName = urlencode('Harry');
$obj->address = urlencode('#1234 Mohali');
$obj->city = urlencode('Chandigarh');
$obj->state = urlencode('Punjab');
$obj->zip = urlencode('160059');
$obj->startDate = urlencode("2014-07-21T05:38:48Z");
$obj->billingPeriod = urlencode("Day"); // or "Day", "Week", "SemiMonth", "Year"
$obj->billingFreq = urlencode("30"); // combination of this and billingPeriod must be at most a year
$obj->paymentAmount = urlencode('10');
$obj->currencyID = urlencode('USD'); // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')

/* PAYPAL API  DETAILS */
$obj->API_UserName = urlencode('arunendra-facilitator_api1.smartwinzsolutions.com');
$obj->API_Password = urlencode('1394441618');
$obj->API_Signature = urlencode('A05YM4frUDrScsYqP299BBa4trgEA3InSTImhusSPEE8pKNdBzClRQfC');
$obj->API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";

$task = $_REQUEST['task'];
if($task):

if($task == "setExpressCheckout"):
$obj->createRecurringPaymentsProfile();
endif;
if($task == "cancelRecurringPayment"):
$obj->ManageRecurringPaymentsProfileStatus();
endif;
if($task == "checkprofilestatus"):
$obj->CheckRecurringPaymentsProfileStatus();
endif;
if($task == "updateprofilepayment"):
$obj->UpdateRecurringPaymentsProfile();
endif;
else:
echo 'Error';
endif;
?>
Download complete File here : Paypal Recurring Method

No comments:

Post a Comment