简体   繁体   English

使用PayPal和PHP进行交易

[英]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. 最后是一个普通的Submit按钮,Form的动作是一个名为register.php的文件,它使用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. 但现在我想将PayPal付款整合到其中。

Now, if you can head over to https://btguard.com/join?service=socks , the site works pretty much just like how I want mine. 现在,如果您可以访问https://btguard.com/join?service=socks ,该网站的工作方式就像我想要的一样。 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. 当PayPal出现时,如果在10月8日之前收费99美元,之后收费129美元。 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?) 然后,如果他们完成付款,它会将它们添加到我们的数据库中(但是如果PayPal是否付款,PayPal会告诉您什么?通过POST / GET数据?)

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. 我之前从未使用过API,但是如果有人能提供我应该使用的PayPal API的信息,我就是一个快速学习者。 Thanks for the help. 谢谢您的帮助。

-Daniel -Daniel

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. 您甚至可以将总数默认为129美元,如果日期在10月8日之前,则以30美元的折扣发送给PayPal。 If it is past the 8th, omit the discount. 如果超过8日,则省略折扣。 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. Paypal应该有一个可用于POST的折扣字段,请参阅Paypal变量页面,了解有关这些变量及其正确名称/用法的更多信息。

EDIT 编辑

For more information with the Paypal API, you can head over to the Paypals Developer Center . 有关Paypal API的更多信息,您可以访问Paypals开发人员中心 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! 您可以在哪里设置沙盒帐户来测试您的代码等。还有一些示例说明如何使用Paypal API和不同的代码,例如PHP / ASP等。使用Paypal API的任何人都可以获得丰富的资源!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM