我正在尝试将 Stripe 支付网关集成到 Django oscar,用于在线销售杂货等实物商品的电子商务网站。我使用 python 3.6.3、Django 2.0、Django-oscar 1.6、stripe 1.82.2。
方法一:
所以我在 django-oscar 组中点击了这个链接:
我已经注册了一个 Stripe 帐户并使用我的可发布密钥和测试密钥来配置 Stripe。问题是,当我尝试使用带有“Pay with Card”标签的按钮付款时,它会收集我的卡信息,然后当我单击按钮,它显示“一些钱将从卡中扣除”,如下图所示:预览页面的图像
然后在我点击下订单按钮后,它向我显示: 确认页面的图像
虽然我已经用我的卡付款了。我猜 oscar 似乎不知道付款已经通过 Stripe 完成了?但我不知道如何解决这个问题。
方法 2:我尝试使用 dj-stripe,在这里找到:
https://github.com/dj-stripe/dj-stripe
但是我在https://dj-stripe.readthedocs.io/en/stable-1.0/上阅读了整个文档 ,似乎我只能将它用于需要订阅的产品,我的不需要订阅和文档dj-stripe 不完整。
我尝试使用官方 django-oscar 存储库,链接在这里:https : //github.com/django-oscar/django-oscar-stripe,这个存储库已经有五年历史了,我认为它不兼容与我的 Django oscar 版本一起使用。
方法 3:我尝试使用 stripe.js 和元素并创建我的表单来接受卡片:
< script src = "https://js.stripe.com/v3/" > < /script> <
script >
var stripe = Stripe('your_stripe_publishable_key');
var elements = stripe.elements();
// Custom styling can be …Run Code Online (Sandbox Code Playgroud)我正在浏览股票记录模型的代码here,在 num_allocated 字段上方,它在评论中说,
#: The amount of stock allocated to orders but not fed back to the master
#: stock system. A typical stock update process will set the num_in_stock
#: variable to a new value and reset num_allocated to zero
Run Code Online (Sandbox Code Playgroud)
那么,当产品缺货时,我如何按照评论中指定的方式进行库存更新过程?我需要将 num_in_stock 变量设置为新值并将 num_allocated 设置为零。
到目前为止,如果订单正在发货,我会调用 EventHandler 类中的 consumer_stock_allocations() 方法,并且订单中产品的库存数量正在减少。
如果有人已经实现了这个,请分享一些代码或一些例子,因为我是 oscar 的新手。
我正在使用邮递员网络版本。
我使用 POST on 发送请求url = localhost:3000/students
但它给出了错误:
Could not send request
Cloud Agent Error: Can not send requests to localhost. Select a different agent.
Run Code Online (Sandbox Code Playgroud)
请帮忙做什么:(
django ×2
django-oscar ×2
express ×1
html ×1
javascript ×1
node.js ×1
postman ×1
python ×1
python-3.x ×1
stripe.js ×1