编程一种非常简单的方法来从网站上购买商品?

发布于 2024-08-17 07:58:06 字数 1566 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

只是一片海 2024-08-24 07:58:06

如果您想向其他人付款,有一系列令人眼花缭乱的电子商务软件包可以做各种时髦的事情,但实际上并不会告诉您它们是否支持您想要的简单的“付费和下载”系统。我花了很长时间寻找,然后发现他们都做得太多了(购物车等),所以我选择自己动手。

如果您乐意编写一些代码,一个“简单”的方法是选择像 Paypal 这样的提供商,并实现一个基本的 IPN 处理程序,该处理程序会在交易完成时发布下载。这是一个蠕虫罐头——有一个巨大的学习曲线和网上有很多非常糟糕的(嗯,误导性的)文档/信息,但是一旦你弄清楚它是如何工作的,一切都相当简单。

例如,对于 PayPal...

“立即购买”部分很简单:PayPal 的网站将为您生成一个按钮,您在表单中敲击它,鲍勃就是您的叔叔。这会引发交易,将用户转移到 Paypal,收取他们的钱,然后...默认情况下会向您发送一封电子邮件,内容为“请立即将此 T 恤发送给此人”。对于立即下载没有用!要发布下载,您需要处理 IPN(即时付款通知)以对正在完成的交易做出反应。仔细阅读有关 IPN 和 PDT 的信息。 IPN 在不同的会话中返回到您的网站,并且是连接到用户会话的完整的猪(除非他们登录到您在数据库中设置的帐户,我确信您正在努力避免这种情况)。 PDT 允许您在用户返回您的网站时获取相关信息(完美),但也有缺点,如果用户忘记返回您的网站,他们将一无所获(啊!)。因此,理想情况下,您需要实施 IPN(使用数据库支持的会话)或 IPN+PDT,以确保用户得到他们购买的东西。

Paypal 有一个沙箱,因此您可以设置您的网站来使用它,并根据需要购买/出售测试您的代码,而无需花费任何真实资金。

我发现的主要陷阱: PayPal 上的某些选项会产生意想不到的副作用...例如,如果您要求客户自动返回您的网站,那么 Paypal 发送给您的数据就会发生根本性的变化,并且您精心设计的所有代码都会崩溃。此外,初始表单中有一个“自定义”字段,允许您向 paypal 发送 200 个字符的数据,并且这些数据会在 IPN/PDT 信息中返回给您 - 非常适合在整个交易中保持会话活动。

If you want to pay someone else, there are a bewildering array of ecommerce packages that do all kinds of snazzy things, but don't actually tell you if they support the simple "pay and download" system that you want. I spent ages looking and then decided that they all did far too much (shopping carts etc), so I opted to roll my own.

If you're happy to write some code, a "simple" approach is to go for a provider like Paypal and implement a basic IPN handler that releases a download when the transaction is complete. This is a can of worms - there's a huge learning curve and a lot of very poor (well, misleading) documentation/information on the net, but once you figure out how it works, it's all rather simple.

For example, with PayPal...

The Buy Now part is easy: PayPal's website will generate a button for you, you whack it in a form and bob's your uncle. This sets off the transaction, passes the user over to Paypal, takes their money, and then... by default sends you an email saying "please send this T-Shirt to this person now". Useless for immediae download! To release a download, you need to handle IPN (instant payment notification) to react to the transaction being completed. Read carefully the information on IPN and PDT. IPN comes back to your website in a different session and is a complete pig to connect up to the user's session (unless they have logged in to an account you have set up in a database, which I'm sure you're trying to avoid). PDT allows you to get at the relevant information when the user returns to your website (perfect) but has the down side that if the user forgets to return to your website, they get nothing for their money (argh!). So you ideally need to implement IPN (with a database-supported session) or IPN+PDT to be sure the user will get what they bought.

Paypal has a sandbox, so you can set up your website to use this and buy/sell as much as you need to test your code without spending any real money.

The main gotchas I discovered: Certain options on PayPal have unexpected side effects... e.g. if you ask for customers to be automatically returned to your website, then the data that Paypal sends you changes radically, and all your carefully crafted code falls apart. Also, there is a "custom" field in the initial form which allows you to send 200 characters of data to paypal, and this is returned to you in the IPN/PDT information - ideal for keeping a session alive across the transaction.

泅渡 2024-08-24 07:58:06

Paypal 或 Authorize.net - 都会为您生成“立即购买”按钮。更不用说许多购物车都提供数字下载产品,但这需要一些配置。如果您想远离编程,那么我建议您选择前两个选项之一。对于这个问题存在许多解决方案,谷歌搜索“销售数字文件”出现了很多。

如果您对代码/编程不感兴趣,那么您最好访问 http://startups.com 并在那里问这个问题。

Paypal or Authorize.net - both generate "buy now" buttons for you. Not to mention the fact that many shopping carts offer digital-download products, but this will require some configuration. If you're wanting to stay away from programming, then I'd suggest you go with one of the first two options. Many solutions exist for this very thing, a google-search on "sell digital files" turned up many.

If you're not interested in code/programming, then perhaps you'd be best off visiting http://startups.com and asking this question there.

流星番茄 2024-08-24 07:58:06

我很幸运地使用了 NopCommerce 以及 Authorize.net

NopCommerce 为您提供了大量您想要的功能可以选择使用。

I've had a lot of luck with NopCommerce coupled with Authorize.net

NopCommerce gives you tons of features that you have the option to use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文