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:

  • PayPal payments require a redirect to PayPal. Direct Credit Card payments are supported for certain countries which can be found here.
  • When you use Vault, PayPal will swap the card information for a Card ID that you will then utilize later for charging that customer. More information can be found here.
  • Yes, you will need to store the Card ID and Payer ID (if used) so that you can reference those later to charge the customer. If you use a Payer ID initially when storing the card, then you will also need to pass it along with the Card ID later when doing the payment. More information on this can be found on the same page as the link in #2 above.
  • PayPal will not provide you card details from a customer's PayPal account. If you are wanting to charge a customer's card at a later time, you will need to utilize the Vault feature. Again, keep in mind that since Vault used Direct Credit Card for processing, you'd have to be registered in a supported country (link in #1 above).
  • Please reference #1 above.

  • You only have to log in if you're using a PayPal account to pay. If you subscribe to Website Payments Pro you can take their credit card without a PayPal account
  • Whenever you run a credit card transaction with PayPal, PayPal gives you a transaction ID. You can use this to run the card again using DoReferenceTransaction (Classic API)
  • Recurring Payments is a separate subscription and a separate set of API calls. But PayPal will manage your recurring billing based on your settings
  • Unless you save the user's credit card details (and some cannot be saved due to PCI, like CVV2) you will not be able to get them later.
  • If you subscribe to Website Payments Pro and Recurring Payments (have to have both), you can take their credit card on your website. You will, however (per PayPal's TOS), have to offer an Express Checkout option as well

  • 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

    上一篇: 改造仅在第一次给出EOFException

    下一篇: Paypal Rest API的工作