Jump to Page:   1 · 2  |  Next Page
Recurrent Payments with PayPal Pro
Options    Options  
raj47i
Visitor
Posts: 7
Registered: 10-27-2009


raj47i

Message 1 of 11

Viewed 459 times



Hi I need to create Recurrent Billing with PayPal Pro.
 
I already completed and tested the ExpressCheckout Part.  
 
Now need to do the DirectPay - Credit card with out redirection.
I have included the contents of a standalone demo file i use below, i used for testing DirectPay, however it always returns 
 
Array ( [TIMESTAMP] => 2009-10-27T16:37:22Z [CORRELATIONID] => aace0727c2711 [ACK] => Failure [VERSION] => 50.0 [BUILD] => 1073465 [L_ERRORCODE0] => 10501 [L_SHORTMESSAGE0] => Invalid Configuration [L_LONGMESSAGE0] => This transaction cannot be processed due to an invalid merchant configuration. [L_SEVERITYCODE0] => Error [AMT] => 100.00 [CURRENCYCODE] => USD )
 
 
Can somebody please help ?
 
Also, Will I have to use an IPN notifier ?
And  how does an IPN actually work ? Is that something like a Cron job that is initiated by the PayPal whenever a CCard txn is completed ?
 
thanks in advance.  
 
 
 ============ ============ ============ ============ ============
<?php

/*

 
 */

define('PayPal_APIUser', '');
define('PayPal_APIPass', '');
define('PayPal_APISign', '');
define( 'Live', false );
class PayPalR{
private
$APIUserName = '',
$APIPassword = '',
$APISignature = '',
$APIURL = '',
$Version = '',
$CurlObj = false,
$Token = '',
$GateWay = '',
$nvpBase = ''
;

public function __construct(){
$this->APIUser = PayPal_APIUser;
$this->APIPass = PayPal_APIPass;
$this->APISign = PayPal_APISign;
$this->APIURL = Live
? 'https://api-3t.paypal.com/nvp'
: 'https://api-3t.sandbox.paypal.com/nvp'; //https://api-3t.beta-sandbox.paypal.com/nvp
$this->GateWay = Live
? 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout'
: 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout';
$this->Version = '50.0';
$this->nvpBase = 'VERSION=' . urlencode($this->Version) . '&PWD=' . urlencode($this->APIPass) . '&USER=' . urlencode($this->APIUser) . '&SIGNATURE=' . urlencode($this->APISign);
}
private function DoCURL($nvp){
# Init CURL & sent the CURL PARAMs
$curlObj = curl_init($this->APIURL);
// turning off the server and peer verification(TrustManager Concept).
curl_setopt($curlObj, CURLOPT_VERBOSE, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_POST, 1); // setting the nvpreq as POST FIELD to curl
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $nvp);
# Execute CURL request..
$httpResponse = curl_exec($curlObj);
if(!$httpResponse){
exit( 'SetExpressCheckout failed: ' . curl_error($curlObj) . ' ('.curl_errno($curlObj).')');
}
# Parse the CURL Respose to an Array
$httpResponseAr = explode("&", $httpResponse);
$httpParsedResponseAr = array();
foreach ($httpResponseAr as $i => $value){
$tmpAr = explode("=", $value);
if(is_array($tmpAr)){
@$httpParsedResponseAr[$tmpAr[0]] = urldecode($tmpAr[1]);
}
}
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)){
exit("Invalid HTTP Response for POST request ($nvp) to {$this->APIURL}.":smileywink:;
}
if(empty($this->Token)){
$this->Token = @$httpParsedResponseAr['TOKEN'];
}
return $httpParsedResponseAr;
}
public function GetRecurringPaymentsProfileDetails($p){
$nvpRequest  = $this->nvpBase . '&METHOD=GetRecurringPaymentsProfileDetails'
. '&PROFILEID=' . urlencode($p['PROFILEID'])
 ;
return $this->DoCURL($nvpRequest);
}
public function DirectPay($p){
 
$nvpRequest  = $this->nvpBase . '&METHOD=DoDirectPayment'
#. '&TOKEN=' . urlencode($p['TOKEN'])
. '&PAYMENTACTION=' . urlencode($p['PAYMENTACTION'])
. '&AMT=' . urlencode($p['AMT'])
. '&CREDITCARDTYPE=' . urlencode($p['CREDITCARDTYPE'])
. '&ACCT=' . urlencode($p['ACCT'])
. '&EXPDATE=' . urlencode($p['EXPDATE'])
. '&CVV2=' . urlencode($p['CVV2'])
. '&FIRSTNAME=' . urlencode($p['FIRSTNAME'])
. '&LASTNAME=' . urlencode($p['LASTNAME'])
. '&STREET=' . urlencode($p['STREET'])
. '&CITY=' . urlencode($p['CITY'])
. '&STATE=' . urlencode($p['STATE'])
. '&ZIP=' . urlencode($p['ZIP'])
. '&COUNTRYCODE=' . urlencode($p['COUNTRYCODE'])
. '&CURRENCYCODE=' . urlencode($p['CURRENCYCODE'])
. '&ORDERDESC=' . urlencode($p['ORDERDESC'])
. '&L_BILLINGTYPE0=' . urlencode($p['L_BILLINGTYPE0'])
. '&L_BILLINGAGREEMENTDESCRIPTION0=' . urlencode($p['L_BILLINGAGREEMENTDESCRIPTION0'])
. '&L_PAYMENTTYPE0=' . urlencode($p['L_PAYMENTTYPE0'])
;
$nvpRequest    .= '&DESC=Organization Subscription';
$nvpRequest    .= '&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=Organization Subscription';
return $this->DoCURL($nvpRequest);
}
}
$p = new PayPalR();
$card['PAYMENTACTION']="Sale";
$card['AMT']='100';
$card['CREDITCARDTYPE']="Visa";
$card['ACCT']="4397920706128982";
$card['EXPDATE']="022010";
$card['CVV2']="382";
$card['FIRSTNAME']="Test";
$card['LASTNAME']="User";
$card['STREET']="1 Main St";
$card['CITY']="San Jose";
$card['STATE']="CA";
$card['ZIP']="95131";
$card['COUNTRYCODE']="US";
$card['CURRENCYCODE']="USD";
$card['ORDERDESC']="ithano problem ?";
$card['L_BILLINGTYPE0']="RecurringPayments";
$card['L_BILLINGAGREEMENTDESCRIPTION0']="9.99 per month for whatever";
$card['L_PAYMENTTYPE0']="Any";

$r = $p->DirectPay($card);

print_r($r);
?> 
 ============ ============ ============ ============ ============ 
Kudos!
Solved!
Go to the Solution
Go to Solution
10-27-2009 10:07 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
angelleye
Ace Developer
Posts: 3154
Registered: 06-25-2006


angelleye

Message 2 of 11

Viewed 457 times


You just need accept the billing for Payments Pro in the seller account.
 

1
Kudos!
10-27-2009 10:09 AM  
Re: Recurrent Payments with PayPal Pro   [ Edited ]
Options    Options  
raj47i
Visitor
Posts: 7
Registered: 10-27-2009


raj47i

Message 3 of 11

Viewed 452 times


Can you please tell me how to do it in the Sandbox account.

:-( I am sorry, but i really cannot find it.  

Message Edited by raj47i on 10-27-2009 11:01 PM
Message Edited by raj47i on 10-27-2009 11:01 PM
Kudos!
10-27-2009 10:28 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
PP_MTS_Chad Moderator
Moderator
Posts: 5200
Registered: 09-23-2008


PP_MTS_Chad

Message 4 of 11

Viewed 449 times


raj47i,

 

You should be able to test with this now on your sandbox account.  I have enabled Website Payments Pro on your account.

1
Kudos!
10-27-2009 10:32 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
raj47i
Visitor
Posts: 7
Registered: 10-27-2009


raj47i

Message 5 of 11

Viewed 445 times


thank you, I just found the option as well. :-) 

 

Kudos!
Accepted Solution
Accepted Solution
10-27-2009 10:41 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
raj47i
Visitor
Posts: 7
Registered: 10-27-2009


raj47i

Message 6 of 11

Viewed 441 times


One more question,

 

When is the Credit card Payment actually confirmed? With the API call I get this response only.

 

Array ( [TIMESTAMP] => 2009-10-27T17:38:57Z [CORRELATIONID] => 861ffedc39f5a [ACK] => Success [VERSION] => 50.0 [BUILD] => 1073465 [AMT] => 100.00 [CURRENCYCODE] => USD [AVSCODE] => X [CVV2MATCH] => M [TRANSACTIONID] => 9J5058985L8997512 )

 

 

Where should I activate the subscribing users account ? Will I have to use that so called IPN? 

 

1
Kudos!
10-27-2009 10:47 AM  
Re: Recurrent Payments with PayPal Pro   [ Edited ]
Options    Options  
angelleye
Ace Developer
Posts: 3154
Registered: 06-25-2006


angelleye

Message 7 of 11

Viewed 430 times


Yeah, IPN would send you a recurring_payment_profile_created notification, but you should receive profile details back from the CreateRecurringPaymentsProfile response.
Message Edited by angelleye on 10-27-2009 01:10 PM

 

Kudos!
10-27-2009 11:09 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
PP_MTS_Chad Moderator
Moderator
Posts: 5200
Registered: 09-23-2008


PP_MTS_Chad

Message 8 of 11

Viewed 428 times


raj471,

 

Correct, you would want to use IPN so that you get a response back if you are processing an initial payment with API request.  You will than get an IPN for the profile getting created and one for the initial charge and any recurring charges down the road.

1
Kudos!
10-27-2009 11:10 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
raj47i
Visitor
Posts: 7
Registered: 10-27-2009


raj47i

Message 9 of 11

Viewed 426 times


thanks alot. that solves all my problems.

 

:-) 

Kudos!
10-27-2009 11:17 AM  
Re: Recurrent Payments with PayPal Pro
Options    Options  
syamnath
Newbie
Posts: 1
Registered: 10-28-2009


syamnath

Message 10 of 11

Viewed 324 times


Hi I am having same issue and your suggestion help me out.

But using IPN, PayPal sends a single word back, which is either

VERIFIED or INVALID. Is there any way to get the PROFILEID and LASTPAYMENTDATE? 
Kudos!
10-28-2009 04:21 AM  
Jump to Page:   1 · 2  |  Next Page
Copyright © PayPal. All Rights Reserved. By using this site, you agree to be bound by PayPal's Legal Disclaimer, User Agreement, and Privacy Policy. This site is subject to change without notice. All other products and company names are trademarks of their respective corporations.