Working Of Paypal Rest API
I am not able to understand the Paypal API correctly. I am trying to understand the PHP SDK used for payments.
I tried to check out the Paypal Integration as well.
What I am not able to understand is.
Does it not require logging in a user?
What does it really mean Storing a Credit Card with Paypal. Does this mean that the Credit Card is stored in API or the Credit Card is stored in a Paypal User's Profile
How should I go about carrying Recurring Payments in this. I understand I need to use the Credit Card ID to get all the Credit Card details, and there by carry the payments. Does this mean, I have to store the Credit Card ID in my Database and therefore use it for future recurring payments/subscriptons? Do I also have to store the Payer ID?
How should I go about getting the User's Details. If lets say, the 1st point is wrong and it does require a user login, then how should I go about getting the Credit Card details already stored in that user's account?
I don't want the user to go to Paypal's site, I mean, the payment should be carried out totally on my website without getting redirected to Paypal. How should I go about doing that?
Can you please explain me step by step on how to go about carrying out the payments(Recurring Payments with Paypal API). I don't need any code, just need to know how it works and what steps to take and when for a secured payment.
Here is the information in regards to the RESTful APIs:
try below code for IPN:
$postipn = 'cmd=_notify-validate';
$orgipn = '';
foreach ($_POST as $key => $value)
{
$postipn .= '&' . $key . '=' . urlencode (stripslashes ($value));
}
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0rn";
$header .= "Host: www.sandbox.paypal.comrn"; // for sandbox
//$header .= "Host: www.paypal.comrn"; // for live
$header .= "Content-Type: application/x-www-form-urlencodedrn";
$header .= "Content-Length: " . strlen($postipn) . "rnrn";
$port = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); // for sandbox
//$port = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);// for live
if ((!$port AND !$error))
{
echo $error .= 'Problem: Error Number: ' . $errno . ' Error String: ' . $errstr;
exit ();
return 1;
}
fputs ($port, $header . $postipn);
while (!feof ($port))
{
$reply = fgets ($port, 4000);
$reply = trim ($reply);
}
//if (!strcmp ($reply, 'VERIFIED'))
if (strcmp ($reply, "VERIFIED") == 0)
{
if ($payment_status == 'Pending')
{
//logtransaction ('PayPal', $orgipn, 'Pending');
exit ();
}
$idnumber = $_POST['custom'];
// your code here
$update_status_query = "Update booking_name SET `status` = 'Confirmed' WHERE `registration_number` = '".$idnumber."' ";
mysql_query($update_status_query);
}
fclose ($port);
exit ();
?>
Find more details on: http://blog.phpcode.co.in/php/paypal-integration/
链接地址: http://www.djcxy.com/p/78024.html下一篇: Paypal Rest API的工作