Paypal付款按钮和IPN:如何唯一地链接用户?

问题描述 投票:10回答:4

奇怪的是,贝宝​​(Paypal)网站上的文档没有对此进行很好的介绍。

我们有一个付款按钮,可重定向到贝宝以处理付款。

我们还有一个正在运行的IPN服务器,可以在付款后捕获贝宝付款。

但是,我们可以在哪里将系统用户的“用户ID”放在paypal按钮中,以便将其转发到IPN请求,以使其与我们系统上已付费的用户匹配。 Paypal似乎希望人们手动执行此操作,这是一项真正的任务。

paypal
4个回答
4
投票

我目前正在进行一些PayPal集成,并且我同意他们的文档很乱!

我终于在某处找到了一个指南,其中详细说明了PayPal按钮形式的哪些变量被转发到IPN回调。您可以使用变量item_name转发用户ID:

<input type="hidden" name="item_name" value="{user id}">

3
投票

您应使用:

<input type="hidden" name="item_number" value="{user id}">

这里是文档:

https://www.paypalobjects.com/IntegrationCenter/ic_std-variable-ref-buy-now.html


3
投票

如文档(https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/)中所述

以您的形式:

<input type="hidden" name="custom" value="<?php echo $id ?>">

并通过ipn获得它:

$_POST['custom']

0
投票

对于试图使此功能适用于Paypal SmartButtons的任何人,您都应该执行以下操作:

return actions.order.create({
  purchase_units: [{
       invoice_id: 'your_custom_stuff1',
       custom_id: 'your_custom_stuff2',
       amount: {
         value: '100'
       }
  }]
});

IPN将其作为POST数据发送,例如在PHP中:

$_POST['invoice']; // 'your_custom_stuff1'
$_POST['custom']; // 'your_custom_stuff2'
© www.soinside.com 2019 - 2024. All rights reserved.