paypal returnurl 是登录页面

发布于 2024-08-06 07:39:50 字数 426 浏览 3 评论 0原文

我有一个关于在用户登录的页面上使用 paypal 的问题,

它是使用 php

如果 paypal 重定向回该页面,如何让用户仍然获得该页面的授权。

我读到一些关于使用 PDT 将 session_id 赋予自定义变量的内容 如果您有多个会话变量怎么办?您还可以将数组传递给自定义变量吗?

它是如何完成的,编码方面的

任何见解都很好

编辑:

PDT 自定义变量是否只是您粘贴在后面的一些自我发明的名称 其他义务变量。

像这样:

$req = "tx=$tx&at=$token&cmd=$cmd";

$req .= "&somevariablename=".session_id();

谢谢,理查德

I have a question about using paypal on a page where the user is logged into

It is with php

How can you have the user still authorised for that page if paypal is redirecting back to that page.

I read something about giving the session_id to the custom variable with PDT
What about, if you have multiple session variables. Can you also pass an array to the custom variable?

How is it done, codingwise

any insights are good

edit:

Is the PDT custom variable just some self invented name that you stick behind the
other obligated variables.

like so:

$req = "tx=$tx&at=$token&cmd=$cmd";

$req .= "&somevariablename=".session_id();

thanks, Richard

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

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

发布评论

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

评论(5

鸩远一方 2024-08-13 07:39:50

可能我错过了一些东西。

因此,您的用户登录.. 单击“立即购买”按钮或其他任何按钮,然后转到贝宝网站,完成后返回到位于用户区域内的页面上的网站。

这应该可以无缝工作,您无需执行任何操作。除非用户在 paypal 网站上花费太多时间并且服务器上的会话过期时间已达到,或者用户关闭浏览器并直接进入您的 paypal 支付页面。

会话将一直保持活动状态,只要会话超时允许,用户就可以在您的站点和其他站点之间无缝地来回移动。

May be i am missing something.

So your user logs in .. clicks on buy now button or whatever and goes to paypal site, when finished comes back to your site on a page which lies inside the user area.

This should work seamlessly without u having to do anything. UNLESS the user spends too much time on the paypal site and the session expire time is reached on the server OR the user closes the browser and goes directly to your paypal payment page.

The session will stay alive for its live and the user can move back and forth between your site and some other seamlessly as long as the session timeout allows.

无声静候 2024-08-13 07:39:50

所以如果我理解正确的话:

  1. 用户已登录您的页面。
  2. 他们点击 paypal 按钮/提交表格
  3. 现在他们在 www.paypal.com 上完成交易。
  4. 完成后,他们将被重定向回您的页面。

您可以使用 cookie,但它们不是万无一失的,因为用户可能会禁用它们。

一种可能的方法是制作一个唯一的标识字符串,该字符串将发送到 PayPal,以便它们被重定向到带有该字符串的自定义 URL。在该页面中,您验证它并授权​​用户。

So if I understand correctly:

  1. The user is logged in on your page.
  2. They click on a paypal button / Submit a form
  3. Now they're at www.paypal.com completing their transaction.
  4. Once finished, they are redirected back to your page.

You could use cookies, but they're not fail-safe since the user may have them disabled.

A possible method is making a unique identification string that would be sent to paypal so they are redirected to a custom URL with the string. In that page you validate it, and authorize the user.

潇烟暮雨 2024-08-13 07:39:50

只需将当前会话 ID(使用 $id = session_id(); 获取)传递给 Paypal,一旦您获得用户和会话 ID,从 Paypal 返回,只需将会话 ID 设置为 Paypal 使用 session_id( $idPaypalSent);

Just pass the current session id (get it with $id = session_id(); ) to Paypal, and once you get the user, and the session id, back from Paypal just set the session id to the one Paypal sent you using session_id($idPaypalSent);

信仰 2024-08-13 07:39:50

我很抱歉提出了一个老问题,但今天早上我遇到了这个问题。

原来我忘记了 session_start();哦!

当我在返回(订单确认)页面上执行此操作后,结果发现我的会话一直都很好 - 它只是没有在该特定页面上启动。

希望这对某人有帮助

echo 'session var:'.$_SESSION['var'];
if (!isset($_SESSION))
{
    session_start();
}
echo 'session var again:'.$_SESSION['var'];

My apologies for bumping an old question but I had this problem this morning.

Turns out I'd forgotted to session_start(); doh!

after I did that on the return (order confirm) page, turns out that my session was fine the whole time - it just wasn't started on that particular page.

Hope this helps someone

echo 'session var:'.$_SESSION['var'];
if (!isset($_SESSION))
{
    session_start();
}
echo 'session var again:'.$_SESSION['var'];
鹿! 2024-08-13 07:39:50

您对会话ID的概念有误:会话ID不仅仅是另一个会话变量,而是会话的ID,以便您可以将用户分配给会话变量。您可以通过 $sess_id = session_id(); 获取会话 ID,并将其附加到自定义返回变量 "&ppsessid=" 。 $sessid。然后,您可以通过 session_id($_GET['ppsessid']); 设置会话 ID。

You have a wrong concept of session id: The session id is not just another session variable, but the id of the session, so that you can assign the user to the session variables. You can get the session id via $sess_id = session_id(); and attach that to the custom return variable as "&ppsessid=" . $sessid. You can then set the session id via session_id($_GET['ppsessid']);.

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