Make Transactions with PayPal and PHP
So I have a basic form for the users Name, Email, Address, and Gender. At the end is a normal Submit button and the Form's action is a file called register.php which uses POST. It then does a standard check to开发者_如何转开发 see whether the information entered was correct. But now I want to integrate PayPal payment into it.
Now, if you can head over to https://btguard.com/join?service=socks, the site works pretty much just like how I want mine. Enter your info, it checks if it's legit, then it sends you to a payment page Example of Payment Page.
When PayPal comes up, it should charge $99 if it's before Oct. 8, $129 afterwards. Then, if they do complete payment, it would add them our database (but how would PayPal let you know if they paid or not? Through POST/GET data?)
I've never used an API before but if someone can provide information on the PayPal API I should use, I'm a quick learner. Thanks for the help.
-Daniel
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECGettingStarted
Basically you would have your server-side code do the total. You could even default the total to $129 and if the date is prior to Oct. 8th, send it to PayPal with a discount of $30. If it is past the 8th, omit the discount. Paypal should have a discount field you can use to POST to it with, see the Paypal Variables page for more information on these variables and their proper names / usages.
EDIT
For more information with the Paypal API, you can head over to the Paypals Developer Center. Where you can set up a sandbox account to test your code etc. There are also examples of how to use Paypal API's with different codes, such as PHP / ASP etc. Great resource for anyone working with the Paypal API!
精彩评论