Eric @ EricBess WebHome

Wins do not arrogant, not to lose hungry, there is shock chest and face, such as mine Pinghu

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

PayPal IPN process

PAYPAL instant payment notification (IPN) is used PayPal to identify and deal with real-time purchase of server to server communications interface. IPN send the PayPal payment you receive immediate notification and confirmation, and provide payments to be, has been canceled or failure of the state of transactions and other data.

IPN can be used to customize a variety of management and the opening of PayPal's API and communications, including:

  • Custom Web site for customers shopping in real time back
  • Through IPN "transmit" variable to track customers
  • To download the software and other digital products, the distribution of key visit
  • Automatically carry out operations
  • Partners to track sales and commissions
  • In your own database to store information on the transaction

PayPal Sign up now and begin to accept credit card payments.

Search variable

Carried out after the payment, PayPal will be sent to POST through PayPal server notify_url variables specified in the notice sent URL. The script is above the designated paypal_ipn_handler.php, so the creation of this document, and as such the following definition of it:

? [Copy to clipboard] View Code PHP
 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
 10 
 11 
 12 
 13 
  <? Php 
  'includes/user_functions.php' ) ; include ( 'includes / user_functions.php'); 
  'includes/shared_functions.php' ) ; include ( 'includes / shared_functions.php'); 

  / / Assign posted variables to local variables 
  $_POST [ 'payment_status' ] ; $ payment_status = $ _POST [ 'payment_status']; 
  $_POST [ 'mc_gross' ] ; $ amountDue = $ _POST [ 'mc_gross']; 
  $_POST [ 'txn_id' ] ; $ txn_id = $ _POST [ 'txn_id']; 
  $_POST [ 'mc_currency' ] ; $ payment_currency = $ _POST [ 'mc_currency']; 
  $_POST [ 'custom' ] ; $ cartid = $ _POST [ 'custom']; 
  $_POST [ 'business' ] ; $ my_email = $ _POST [ 'business']; 
  $_POST [ 'payer_email' ] ; $ email = $ _POST [ 'payer_email']; 
  ... 

First of all, through PayPal to send POST over an important variable in the preservation of local variables.

Verify payment

To pay for a way to verify is: to collect from PayPal to send over the variables and send them through the re-POST. Continue to define paypal_ipn_handler.php, add the following code:

Click to continue reading

June 15th, 2008 Posted by eric | Coding | no comments

Wordpress database and that wpdb Class

To collate the following information network of non-original

The following are wp-2.0.5 version of the database structure of (ER diagram). Here only lists the primary key and foreign key. Diamond-shaped figure that 1: n relationship, as part of a white, black as part of the n.

wordpress-db-er-diagram.png

Wordpress A total of 10 tables, divided into four categories according to function.

  • user: user information, including wp_users table and wp_usermeta table.
  • post: The article reviews and information, including wp_posts, wp_postmeta, wp_comments, wp_post2cat, as well as five wp_categories table.
  • link: links, including wp_links table and wp_linkcategories table.
  • option: setting the overall situation, including wp_options table.

Table of naming is very interesting. Sum up the basic rules are as follows:

  • To preserve the basic properties of the object, named wp_objects, the use of the plural (for example, wp_posts, wp_comments);
  • Save the expansion of the object attributes, named wp_objectmeta, the use of the singular (for example, wp_postmeta, wp_usermeta);
  • Many-to-many relationship, named wp_a2b, which were b and a many-to-many relationship between the two ends of the object's name abbreviation (for example, wp_post2cat).
WPDB category

http://codex.wordpress.org.cn/Function_Reference/wpdb_Class

http://codex.wordpress.org/Function_Reference/wpdb_Class

Database description

http://codex.wordpress.org/Database_Description # Table_Overview

wp_categories: for the preservation of classified information related to the table. 5, including the field are:

  • cat_ID - each unique ID number classifications for a bigint (20) value, and with additional properties auto_increment.
  • cat_name - a classification name for a varchar (55) value.
  • category_nicename - the classification assigned to a user-friendly names to remember, that is, the so-called slug, this is a varchar (200) value.
  • category_description - a detailed description of the classification, longtext-value.
  • category_parent - the higher the classification categories, as a int (4) value, corresponding to the current table is the cat_ID, that is, wp_categories.cat_ID. No higher level classification, the value is 0.

Click to continue reading

March 12th, 2008 Posted by eric | Database, Wordpress Programming | no comments

PayPal PHP interface

PayPal fast, safe and convenient cross-border trading is the preferred online payment method. PayPal can be now and most of the domestic credit card association, people can achieve the balance of payments cross-border transactions.
PayPal to apply for registration of Web site: https: / / www.paypal.com/

paypal interface with other interface is somewhat different, a little bit complicated. In fact, the bank interface is also a site of the plug-in.

The so-called paypal ipn (Instant Payment Notification), developed by Paypal is a third-party sellers to take the initiative to inform the trading system as a mechanism for the state. The IPN is very simple principle, that is generated when a transaction, the transaction status changes, such as the user has to pay, or refund, when it revoked, Paypal use of commonly used HTTP POST methods, some of the transaction will be submitted to the Web site of the variables A page (referred to as IPN Handler), when this page request received, these data untouched instructions to add a proven cmd = _notify-validate, POST back to the Paypal address of the interface, if the data is correct, then Paypal Return string VERIFIED, or as INVALID, if the result is VERIFIED, then your program will be able to use these data to carry out the operation.

Sandbox open account

However, the debugging code is a very painful thing, because as a third-party developers, it is not possible to open two accounts, each would also like to test some of the transactions between the money, so Paypal has developed a specialized Sandbox to the developers for development, first of all To https: / / developer.paypal.com / registration of a development account, well after the establishment of re-entering the Sandbox test of virtual Paypal account (at least to establish a Business and one of the Personal), this method of registration and Paypal account of the Process, information is false, including bank accounts, credit cards (in fact Paypal Sandbox automatically generate a number of random numbers). The next step to activate Paypal Sandbox virtual account, pay attention to, no matter where you fill in registration Paypal Sanbox what e-mail address, any virtual account number to send the filled-mail messages are kept in the development of account management interface of the page Email ( There are navigation bar). Virtual Sandbox log on Paypal, also need to verify that the virtual bank account, you can not fill, and then to Add Funds to recharge account (fill in the number of how many would like to fill 920-203 920-533). Then, the IPN also need to activate the option of Business in the accounts of the Profile settings page, click, and then click Edit button to open the IPN, here if you are using a fixed IPN Handle, that could fill in the address.

Next, we tested, Paypal should address the interface is set to https: / / www.sandbox.paypal.com / cgi-bin / webscr

1 2 3 4

March 11th, 2008 Posted by eric | Coding, Web technology | no comments