Paypal IPN 回调带参数

发布于 2024-09-02 05:55:07 字数 379 浏览 0 评论 0原文

可能的重复:
我可以向 paypal 发送一个变量,并在付款完成后将其发回给我吗?

我想在用户付款后自动执行一个流程。

1) 用户在表单上输入详细信息并提交,会话将唯一 ID 传递给 paypal 2)用户完成paypal付款后,唯一的ID将传回我的服务器,以便脚本读取并注册到数据库中。

我该怎么做?

Possible Duplicate:
Can I send a variable to paypal, and have it post it back to me when payment completes?

I want to automate a process after user have made a payment.

1) User enter details on forms and submit, the session will pass unique ID to paypal
2) After user complete the paypal payment, unique ID is then pass back to my server for the script to read and register into db.

How do I do that?

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

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

发布评论

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

评论(2

橪书 2024-09-09 05:55:07

我个人使用过 Micah Carrick 的 Paypal IPN 类

当用户提交表单并生成 ID 时,您可以实例化该类并执行以下操作:

$paypal = new paypal_class;
$paypal->add_field('business', YOUR EMAIL);
$paypal->add_field('notify_url', URL OF PROCESSING SCRIPT);
$paypal->add_field('item_name', ITEM NAME);
$paypal->add_field('amount', PRICE);
$paypal->add_field('currency_code', USD or GBP etc);
$paypal->add_field('custom', ID FROM DB INSERT);
$paypal->submit_paypal_post();

自定义 字段对于您的目的来说是最重要的字段,您可以在此处放置任何您想要的内容,它将通过对您设置的 notify_url 脚本的 IPN 调用返回。

在此通知页面上,您可以验证 IPN 调用并检索自定义变量以执行您想要的操作...

$paypal = new paypal_class;
if ($paypal->validate_ipn()) {
    $id = $paypal->ipn_data['custom'];
}

请记住在您的 Paypal 帐户中启用 IPN 回调。

I've personally used Micah Carrick's Paypal IPN class.

When the user submits the form and the ID is generated, you can instantiate the class and do something like this:

$paypal = new paypal_class;
$paypal->add_field('business', YOUR EMAIL);
$paypal->add_field('notify_url', URL OF PROCESSING SCRIPT);
$paypal->add_field('item_name', ITEM NAME);
$paypal->add_field('amount', PRICE);
$paypal->add_field('currency_code', USD or GBP etc);
$paypal->add_field('custom', ID FROM DB INSERT);
$paypal->submit_paypal_post();

The custom field is the most important one for your purpose, you can put whatever you want here and it'll be returned with the IPN call to the notify_url script you have set.

On this notification page, you can validate the IPN call and retrieve the custom variable to do what you want with it...

$paypal = new paypal_class;
if ($paypal->validate_ipn()) {
    $id = $paypal->ipn_data['custom'];
}

Remember to enable IPN callbacks in your Paypal account.

冰雪梦之恋 2024-09-09 05:55:07

不幸的是,您的简单问题并不能很好地解决手头的任务。我建议查看 PayPal 的 IPN 文档,查看 PayPal IPN PHP 示例代码(或通过 Google 搜索人们构建的 IPN 类)。您可能还需要使用 PayPal 开发人员的 IPN 模拟器工具来测试代码。

...最后但并非最不重要的一点是,您需要在实际的 PayPal 商家帐户中设置各种配置,因此值得花一些时间来了解其中的内容。

我最近第一次做这一切。我希望它像即插即用一样简单。玩&开始收钱。它不是。

Unfortunately your simple question doesn't do justice to the task at hand. I recommend looking into PayPal's IPN documentation, checking out the PayPal IPN PHP sample code (or Googling for IPN classes people have built). You'll also likely need to test the code using PayPal Developers' IPN Simulator Tool.

... and last but not least, there's various configurations you need to set in your actual PayPal merchant account, so it's worth taking some to understand what's there.

I recently did all this for the first time. I wish it was as easy as plug & play & start receiving money. It's not.

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