1
votes

I really wanted to do this myself but after almost a week of reading Paypal's documentations about their services and APIs and addon services, I quit. I need help.

I have a website which will have a monthly subscription of three different packages and I would like to use PayPal's Hosted Pages. Now, I'm facing a few problems.

First, their documentation is so damn confusing that I still don't understand it exactly what they offer and what do I need. So, any help would be greatly appreciated. Currently I have Payments Advanced with Recurring Billing addon and Hosted Checkout Page set up. My first problem is that when I make an API call to get a SecureTokenID, I get response 1 (User authentication failed), but the login details are correct, I checked multiple times. Here is my code for making this call:

/* - build NVP to be sent to paypal - */
$post['PARTNER']='paypal';
$post['VENDOR']='*';
$post['USER']='*';
$post['PWD']='*';
$post['TRXTYPE']='S';
$post['AMT']='5';
$post['CREATESECURETOKEN']='Y';
$post['SECURETOKENID']=md5(time().rand().time());
$post['MODE']='TEST';

$url='https://pilot-payflowpro.paypal.com';
/* - do cURL request to PayPal's API - */
 $ch = curl_init();
 curl_setopt ($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// I know, inhere should be a certificate and it will be in final version

 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_POST, 1);

 curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);

// curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10); // 3 seconds to connect
// curl_setopt ($ch, CURLOPT_TIMEOUT, 10); // 10 seconds to complete

 $output = curl_exec($ch);
 if(curl_errno($ch)){
  echo'error:' . curl_error($ch);
 }
 curl_close($ch);

Second problem is, where exactly can I enter a custom variable field, which will represent a database entry, so I will know from IPN which user has subscribed/unsubscribed?

Third, is it possible to set the subscription options in PayPal Manager interface, or must I sent the subscription details on every single transaction?

Fourth, am I going this the right way?? From their website and docs, I understood that I need a Payments Advanced and Recurring Billing, nothing more. Requirement is that the user can't leave the website, so I want to use a Hosted Checkout Page.

EDIT: I solved first and second (this is the second time I figured it out myself after I posted a question over here :)), but I would need help with third and fourth point.

Also I have additional question. Can Recurring Billing be suspended for users's selected period?

1

1 Answers

0
votes

To answer your 3rd question, you would need to send the details over. You would not be able to set the subscription options up in the manager to be what the profile defaults to every time you create one. The only thing you would be able to do in the manager would be log in and set up individual profiles when needed based on the terms that you manually set each time.

As for your other question, you can either use pro and keep the buyer on your site and make the API calls and have full control over the flow or you could use the hosted pages where the credit card section would be on PayPal's pages. You could have this section within an iFrame on your site, so it appears that the merchant is still on your site. You could also use transparent redirect as well if you wanted to.