I have downloaded and implemented this paypal integration lib on my website. https://github.com/hrendoh/PayPal-Express-Checkout-example
The recurring profiles are not getting created.
The function call for Express checkout is
$resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
$ack = strtoupper($resArray["ACK"]);
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
// if SetExpressCheckout is returned with success, move to paypal site for payments.
RedirectToPayPal ( $resArray["TOKEN"] );
}
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL)
{
//------------------------------------------------------------------------------------------------------------------------------------
// Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
$nvpstr="&AMT=". $paymentAmount;
$nvpstr = $nvpstr . "&PAYMENTACTION=" . $paymentType;
$nvpstr = $nvpstr . "&BILLINGAGREEMENTDESCRIPTION=".urlencode("Test Recurring Payment($1 monthly)");
$nvpstr = $nvpstr . "&BILLINGTYPE=RecurringPayments";
$nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
$nvpstr = $nvpstr . "&CURRENCYCODE=" . $currencyCodeType;
$_SESSION["currencyCodeType"] = $currencyCodeType;
$_SESSION["PaymentType"] = $paymentType;
//'---------------------------------------------------------------------------------------------------------------
//' Make the API call to PayPal
//' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment.
//' If an error occured, show the resulting errors
//'---------------------------------------------------------------------------------------------------------------
$resArray=hash_call("SetExpressCheckout", $nvpstr);
$ack = strtoupper($resArray["ACK"]);
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
$token = urldecode($resArray["TOKEN"]);
$_SESSION['TOKEN']=$token;
}
return $resArray;
}
This function is for creating a recurring profile which is not called anywhere in the sample code.
function CreateRecurringPaymentsProfile()
{
//'--------------------------------------------------------------
//' At this point, the buyer has completed authorizing the payment
//' at PayPal. The function will call PayPal to obtain the details
//' of the authorization, incuding any shipping information of the
//' buyer. Remember, the authorization is not a completed transaction
//' at this state - the buyer still needs an additional step to finalize
//' the transaction
//'--------------------------------------------------------------
$token = urlencode($_SESSION['TOKEN']);
$email = urlencode($_SESSION['email']);
$shipToName = urlencode($_SESSION['shipToName']);
$shipToStreet = urlencode($_SESSION['shipToStreet']);
$shipToCity = urlencode($_SESSION['shipToCity']);
$shipToState = urlencode($_SESSION['shipToState']);
$shipToZip = urlencode($_SESSION['shipToZip']);
$shipToCountry = urlencode($_SESSION['shipToCountry']);
//'---------------------------------------------------------------------------
//' Build a second API request to PayPal, using the token as the
//' ID to get the details on the payment authorization
//'---------------------------------------------------------------------------
$nvpstr="&TOKEN=".$token;
#$nvpstr.="&EMAIL=".$email;
$nvpstr.="&SHIPTONAME=".$shipToName;
$nvpstr.="&SHIPTOSTREET=".$shipToStreet;
$nvpstr.="&SHIPTOCITY=".$shipToCity;
$nvpstr.="&SHIPTOSTATE=".$shipToState;
$nvpstr.="&SHIPTOZIP=".$shipToZip;
$nvpstr.="&SHIPTOCOUNTRY=".$shipToCountry;
$nvpstr.="&PROFILESTARTDATE=".urlencode("2011-07-01T0:0:0");
$nvpstr.="&DESC=".urlencode("Test Recurring Payment($1 monthly)");
$nvpstr.="&BILLINGPERIOD=Month";
$nvpstr.="&BILLINGFREQUENCY=5";
$nvpstr.="&AMT=1";
$nvpstr.="&CURRENCYCODE=USD";
$nvpstr.="&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
//'---------------------------------------------------------------------------
//' Make the API call and store the results in an array.
//' If the call was a success, show the authorization details, and provide
//' an action to complete the payment.
//' If failed, show the error
//'---------------------------------------------------------------------------
$resArray=hash_call("CreateRecurringPaymentsProfile",$nvpstr);
$ack = strtoupper($resArray["ACK"]);
return $resArray;
}
can I call this function to create the recurring profile in returnurl and pass the token id and payer id to this function.