Paypal 的基本工作流程问题 + ASP .NET Web 应用程序集成

发布于 2024-09-19 20:20:01 字数 654 浏览 1 评论 0原文

我正在为我的软件产品设置一个支付网关,用户可以从网上购买并使用该网关。我使用贝宝网站付款标准来开始。

有一个基本问题困扰着我。我的用户的工作流程是: 登录我的产品网站(试用期免费许可证)->付费延长许可证

现在假设一个用户 - [email protected] 在我的网站上注册网站并登录。然后我向他展示“立即购买”按钮(贝宝的)。他点击它,被重定向到贝宝,付款,被重定向回我的网站。在后台,我设置了 PayPal 的 IPN 功能并收到有关此交易及其详细信息的通知。现在 - 我如何将这次购买与我的用户关联起来?我如何知道[email protected]已付款。

注意:我没有使用自动返回+ PDT 方法,因为它的基本缺陷 - 如果用户在付款后但在返回自动返回页面之前关闭浏览器,我的后付款逻辑永远不会运行。使用 IPN 可以保证后付款逻辑的运行,但如何将付款与我网站上发起和完成付款的用户名关联起来?

I'm setting up a payment gateway for my software product which users can buy off the web and use. I'm using paypal website payments standard to get started.

There's a basic issue troubling me. The workflow for my user is:
Login to my product site (free license for a trial period) -> Pay to extend license

Now suppose a user - [email protected] registers on my site and logs in. I then show him the buy now button (paypal's). He clicks on it, gets redirected to paypal, pays, gets redirected back to my site. In the background, I set up paypal's IPN feature and get notified of this transaction and its details. Now - how do I link this purchase with my user? How do I know that [email protected] made the payment.

Note: I'm not using autoreturn + PDT method because of its basic flaw - if user closes browser after payment but before returning to the autoreturn page, my post payment logic never runs. Using IPN guarantees running of post payment logic but how do I link the payment with the username on my site that initiated and completed the payment?

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

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

发布评论

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

评论(2

江挽川 2024-09-26 20:20:01

对于您的用户付款,您创建一个为付款发送的唯一 ID,然后通过 IPN 将其取回。

用于将其放入 PayPal 的代码:“发票

以下是代码:
https://cms.paypal.com /us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables

查看表 4。

发票 ->
您可以使用传递变量来识别本次购买的发票号码。

以下是 IPN 的代码 https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside

if (strResponse == "VERIFIED")< 上的 /strong>{...您可以获取发票...只需阅读 Request.Form["invoice"]

Ps 您可以同时使用 PDT 和 IPN,并且可以合并两者的结果。

For your user payment you create a unique ID that you send for the payment, and you get it back on IPN.

The code to use for place it on PayPal:"invoice"

Here are the codes:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables

Look at table 4.

invoice ->
Passthrough variable you can use to identify your invoice number for this purchase.

Here is a code for IPN https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside

on the if (strResponse == "VERIFIED"){... you can get the invoice... just by reading the Request.Form["invoice"]

Ps You can use both PDT and IPN and you can merge the results from both.

撕心裂肺的伤痛 2024-09-26 20:20:01

您需要设置 ASP.NET 配置文件来注册订阅者。这允许您在通过 IPN 验证每个用户后,在数据库中存储每个用户的额外详细信息。在将详细信息发送到 PayPal 之前,您可以创建一个 GUID 以将订单与注册用户相关联。

如果您使用的是 ASP.NET 网站项目模板,则您可以使用开箱即用的配置文件。如果您使用的是 ASP.NET Web 应用程序项目模板,则可以使用 Web 配置文件生成器来设置配置文件:

http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for -web-application-projects.aspx

这是另一种很酷的方法:

http://leedumond.com/blog/asp-net-profiles-in-web-application-projects/

要将付款与您网站上的用户名关联起来,生命周期将为如下:

1)使用PayPal订阅处理初始免费期:-)

2) 用户在您的网站上订阅并被定向到 PayPal 网站

3) 您的 IPN 类与 PayPal 握手并获取 PayPal 返回的值

4) 您的IPN 类会更新您的应用程序数据库,并生成一封电子邮件给订阅者,其中包含用于在您的网站上注册的返回 URL

5) 您的 IPN 类会向商家生成一封电子邮件(备份),其中包含订阅数据

6) 订阅者在您的网站上创建一个用户帐户网站,并且您设置了要在其个人资料中存储的任何额外会员信息

protected void Createuserwizard1_CreatingUser(object sender, EventArgs e)
{
    WebProfile p = WebProfile.GetProfile(CreateUserWizard1.UserName, true);
    p.Initialize(CreateUserWizard1.UserName, true);

    p.subscriberID = ViewState["SubscriberID"].ToString();
    p.subscriberExpireDate = ViewState["ExpireDate"].ToString();

    p.Save();
} 

一些问题:

不要使用 PayPal 的返回 URL

不要混合 IPN 和 PDT。 IPN 就是您所需要的一切

创建配置文件时不要忘记 Save() 方法 :-S

You need to set up ASP.NET Profiles for registering subscribers. This allows you to store extra details for each user in the database after they have been verified via IPN. Before sending the details to PayPal you could create a GUID to relate the order to the registered user.

If you are using the ASP.NET Web site project template, you have Profiles out of the box. If you are using an ASP.NET Web Application project template, you can use the Web Profile Builder to set up Profiles:

http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx

Here's another cool way to do it:

http://leedumond.com/blog/asp-net-profiles-in-web-application-projects/

To link the payment with the username on your site, the lifecycle would be as follows:

1) Use PayPal Subscriptions to handle the initial free period :-)

2) User subscribes on your site and is directed to the PayPal site

3) Your IPN class handshakes with PayPal and grabs the values returned by PayPal

4) Your IPN class updates your application database and generates an email to the subscriber with a return URL to register on your site

5) Your IPN class generates an email (backup) to the merchant with the subscription data

6) The subscriber creates a user account on your site and you set up any extra member info you want to store in their profile

protected void Createuserwizard1_CreatingUser(object sender, EventArgs e)
{
    WebProfile p = WebProfile.GetProfile(CreateUserWizard1.UserName, true);
    p.Initialize(CreateUserWizard1.UserName, true);

    p.subscriberID = ViewState["SubscriberID"].ToString();
    p.subscriberExpireDate = ViewState["ExpireDate"].ToString();

    p.Save();
} 

Some Gotchas:

Do not use a return URL from PayPal

Do not mix IPN and PDT. IPN is all you need

Do not forget the Save() method when creating the profile :-S

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