Paypal IPN 使用 PHP 获取定制数量和金额
我已经使用 php 下载了示例 paypal IPN 脚本,并使用购买选项的电子邮件进行了自定义,它还有一些隐藏参数,例如金额、数量、return_url、notify_url 等。我的主要想法是在我的网站上为产品购买提供买断选项。产品购买的当前计算如下:
Item Price:$20
Quantity :10
Total amount $200
我需要以某种不同的方式进行计算,因为我们的网站有一些静态的数量和价格集,所以我们的计算要点如下:
Item Price:$20
Quantity :10
Total amount:$20
因此,对于给定的数量,总金额需要相同。IPN 配置不允许我通过这种方式更改数量字段,请提出一些想法来克服此问题。
I have downloaded the sample paypal IPN script using php and customised with the email for the buyout option and it has also some hidden paramaters such as amount, quantity,return_url, notify_url like this. My main idea is to do the buyout option for the product purchase in my website.The current calculation for the product purchase is as follows:
Item Price:$20
Quantity :10
Total amount $200
I need the calculation to some different way as our site have some static set of quantities and prices, so our point of calculation is as follows:
Item Price:$20
Quantity :10
Total amount:$20
So, the total amount needs to be the same for the given number of quantities.The IPN configuration doesn't allow me to change the quantity field by this way, please suggest some ideas to overcome this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
商品价格是每件商品的价格,当然是数量乘以商品价格。您的第二个示例的 --Item-- 价格应为 2 美元。如果您想以 20 美元的价格出售“10 件商品”,我认为您需要为该组合制作一个新商品,并且仅在自定义字段中显示实际数量。
如果您想使用相同的商品和贝宝的数量字段,我认为您需要考虑计算折扣并将该部分作为参数(我认为商品X的discount_amount_cart或discount_amount_X)。
The item price is price per item, the quantity is of course multiplied by the item price. Your second example should have $2 as the --Item-- price. If you want to sell "10 items for $20", I think you will need to make a new item for that combo and just but the actual quantity in a custom field.
If you want to use the same item and paypal's quantity field, I think you need to look into calculating a discount and making that part of the parameters (discount_amount_cart or discount_amount_X for item X I think).