php - PayPal API 购物车和 Webhooks?
问题描述
我使用 PayPal 按钮代码生成器创建了 2 个按钮。
- 添加到购物车
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="sb-3ghgk675036@business.example.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="TestName">
<input type="hidden" name="item_number" value="TestID">
<input type="hidden" name="amount" value="50.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="tax_rate" value="0.000">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit"
alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
- 查看购物车
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="ZAH44BSSBQT6G">
<input type="hidden" name="display" value="1">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_viewcart_LG.gif" border="0" name="submit"
alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
我需要知道是否可以传递应用程序 client_id 而不是(我的业务电子邮件或商家 ID),以便我可以使用这些按钮触发我的服务器上的 Webhook?如果不可能,是否有任何方法可以将 paypal 购物车与 REST API webhook 一起使用?
解决方案
你为什么要使用那个超级旧、丑陋的 web 1.0 购物车?这是一个遗留的东西,只为了向后兼容旧网站而存在。您应该实现自己的 JS 购物车并改用智能支付按钮:https ://developer.paypal.com/demo/checkout/#/pattern/client
无论如何,如果您确实坚持使用旧的 web 1.0 集成并希望将其与 webhook 结合使用,请尝试订阅所有可能的付款捕获/完成 webhook 事件(v1 和 v2)并查看您收到的内容。如果您什么也没收到,您将需要使用旧的即时付款通知 (IPN) 服务而不是 webhook。
推荐阅读
- ios - Swift 发现并将蓝牙 4.0 设备连接到 iphone 11+
- bash - 在 shell 中从文件中写入和读取变量
- google-cloud-platform - 我无法将 GCP autoML 模型导出到存储桶
- python - Python 访问 Azure DevOps 密码值
- couchbase - Couchbase Eventing Service 似乎处于滚动启动状态
- angular - 调整上传到 Google Firebase 的图片大小
- email - 使用mailto时“系统找不到指定的路径”:
- python - `basename` 参数未指定 - DJANGO REST 框架
- .net - RegisterSystemDirectories 和其他方法有什么区别
- java - 通信 tcp server c/client java