Paypal 快速结账优惠券代码
我在我的网站上使用 Paypal Express Checkout 系统。但我想放一个优惠券(折扣)代码区域。如果代码为真,则会减少。 (就像 GoDaddy.com 的购物车系统)
您知道我应该从哪里开始吗?
(我没有使用任何电子商务框架)
I'm using Paypal Express Checkout system on my website. But I want to put a coupon (discount) code area. It will make a reduction if code is true. (Like GoDaddy.com's cart system)
Have you any idea, where should I start for this?
(I'm not using any eCommerce framework)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这是一个旧线程,但想将我的经验放在这里,供其他人寻找相同的东西,也许这在当时不适用,但现在确实适用,至少在沙箱上,这意味着我还没有在实际交易中测试过这一点
添加发送到 PayPal 的商品时,您基本上会发送此
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 1.00
L_PAYMENTREQUEST_0_NAME0 = 我的商品 0 名称
L_PAYMENTREQUEST_0_NUMBER0 = myitem0id
然后我们添加另一个商品
L_PAYMENTREQUEST_0_QTY1 = 1
L_PAYMENTREQUEST_0_A MT1 = 1.00
L_PAYMENTREQUEST_0_NAME1 = 我的商品 1 名称
L_PAYMENTREQUEST_0_NUMBER1 = myitem1id
现在我们添加优惠券
L_PAYMENTREQUEST_0_QTY2 = 1
L_PAYMENTREQUEST_0_AMT2 = -0.50
L_PAYMENTREQUEST_0_NAME2 = 我的优惠券名称
L_PAYMENTREQUEST_0_NUMBER2 = mycouponcode
然后我们添加小计和总值
PAYMENTREQUEST_0_AMT = 1.50
AMT = 1.50
我认为贝宝所做的是广告所有项目总计,所以它可以做到这一点订购类似
1.00+1.00-0.50 = 1.50
然后将其与您的总金额进行比较
,如果匹配则可以,客户将其视为额外项目,但显然带有减号,下图来自 paypal 沙箱快速结帐交易
I know this is an old thread but wanted to put here my experience for others looking for the same thing, and maybe this did not apply then but it does apply now, at least on the sandbox meaning I have not tested this in a real transaction
When adding items that you send to paypal you basically send this
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 1.00
L_PAYMENTREQUEST_0_NAME0 = my item 0 name
L_PAYMENTREQUEST_0_NUMBER0 = myitem0id
Then we add another item
L_PAYMENTREQUEST_0_QTY1 = 1
L_PAYMENTREQUEST_0_AMT1 = 1.00
L_PAYMENTREQUEST_0_NAME1 = my item 1 name
L_PAYMENTREQUEST_0_NUMBER1 = myitem1id
And now we add the coupon
L_PAYMENTREQUEST_0_QTY2 = 1
L_PAYMENTREQUEST_0_AMT2 = -0.50
L_PAYMENTREQUEST_0_NAME2 = my coupon name
L_PAYMENTREQUEST_0_NUMBER2 = mycouponcode
And then we add the subtotal and total values
PAYMENTREQUEST_0_AMT = 1.50
AMT = 1.50
What I think paypal does is ads up all item totals so it would do for this order something like
1.00+1.00-0.50 = 1.50
Then compares it to your total amounts
if they match then it is a go, the customer sees this as an extra item, but obviously with the minus sign, this picture below is from a paypal sandbox express checkout transaction
一种方法是在您的网站上设置购物车,用户可以在其中输入促销代码。一旦他们输入了促销代码并准备好开始结账流程,您就可以将他们重定向到快速结账(您可以在其中向 Paypal 发送订单的最终金额等)。
根据 Paypal 论坛上的这篇文章,他们没有将折扣详细信息传递到结账流程的功能:https ://www.x.com/thread/39681(“通过快速结帐,所有折扣计算都需要在您的网站上完成。”)
在将价格发送到 PayPal 之前如何计算
1) 将促销代码的单独表单添加到您的页面:
2) 在服务器端,检查代码,用新价格相应地更新页面(例如,用新价格重新构建您的选择菜单)。 PHP 示例:
如果您无法访问服务器,我猜您必须使用 JavaScript 来执行此操作(即,将您的促销代码和价格硬编码到页面中)
在服务器上启动快速结账侧面
下载 PHP NVP SDK & Paypal 网站的示例:
https://cms.paypal.com/ us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks
One approach is to have a shopping cart on your site where the user can enter a promo code. Once they've entered their promo codes, and are ready to begin the checkout process, this is when you redirect them to the Express Checkout (where you send Paypal the final amount of your order, etc).
According to this post on Paypal forum, they do not have a feature to pass the discount details to the checkout process: https://www.x.com/thread/39681 ("With express checkout all discount calculations will need to be done on your site.")
How to calculate before sending price to paypal
1) Add a SEPARATE form for the promo code to your page:
2) On the server side, check the code, update the page accordingly with new prices (e.g. re-build your select menu with new prices). Example with PHP:
If you don't have access to the server, you would have to do this with JavaScript I guess (i.e. have your promo-code and price hard-coded into the page)
To initiate express checkout on server side
Download PHP NVP SDK & examples from Paypal's website:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks