The real-time php implementation code of paypal. Paypal.ebay.cnintegrationcenterlist?resource_2.html Chinese php development introduction: www.paypal-china.orgwangzhai197.html The following is the payment code of paypal in ecshop http://paypal.ebay.cn/integrationcenter/list__resource_2.html
Php development introduction: http://www.paypal-china.org/wangzhai/197.html
The following is the payment code for paypal in ecshop:
This code is submitted to the paypal payment interface
{{{
}}}
The following are officially provided parameters that are received by paypal and whether the payment is successful.
After successful submission
Paypal will automatically jump to espond. php? Code = paypal: The page shows the following POST data.
The code is as follows:
// Read the post from PayPal system and add 'cmd'
$ Req = 'cmd = _ policy-validate ';
Foreach ($ _ POST as $ key => $ value ){
$ Value = urlencode (stripslashes ($ value ));
$ Req. = "& $ key = $ value ";
}
// Post back to PayPal system to validate
$ Header. = "POST/cgi-bin/webscr HTTP/1.0 \ r \ n ";
$ Header. = "Content-Type: application/x-www-form-urlencoded \ r \ n ";
$ Header. = "Content-Length:". strlen ($ req). "\ r \ n ";
$ Fp = fsockopen ('SSL: // www.paypal.com ', 443, $ errno, $ errstr, 30 );
// Assign posted variables to local variables
$ Item_name = $ _ POST ['item _ name'];
$ Item_number = $ _ POST ['item _ number'];
$ Payment_status = $ _ POST ['payment _ status'];
$ Payment_amount = $ _ POST ['MC _ gross '];
$ Payment_currency = $ _ POST ['MC _ currency '];
$ Txn_id = $ _ POST ['txn _ id'];
$ Receiver_email = $ _ POST ['receiver _ email '];
$ Payer_email = $ _ POST ['payer _ email '];
If (! $ Fp ){
// HTTP ERROR
Else {
Fputs ($ fp, $ header. $ req );
While (! Feof ($ fp )){
$ Res = fgets ($ fp, 1024 );
If (strcmp ($ res, "VERIFIED") = 0 ){
// Check the payment_status is Completed
// Check that txn_id has not been previusly processed
// Check that receiver_email is your Primary PayPal email
// Check that payment_amount/payment_currency are correct
// Process payment
}
Else if (strcmp ($ res, "INVALID") = 0 ){
// Log for manual investigation
}
}
Fclose ($ fp );
}
?>
Http://www.bkjia.com/PHPjc/322630.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322630.htmlTechArticlehttp://paypal.ebay.cn/integrationcenter/list__resource_2.html Chinese php development introduction: http://www.paypal-china.org/wangzhai/197.html below is the payment code of paypal in ecshop this code...