Paypal 按钮 + IPN(通过付款人用户名)

2021-12-29 00:00:00 php paypal paypal-ipn

有没有办法同时传递和接收自定义变量(例如付款人的用户名)?我不能强迫我的用户使用与他们在我的网站上使用的相同的电子邮件地址(最初由贝宝返回).传递额外的用户名将有助于轻松检查付款人的身份.

Is there a way to also pass and receive the custom variable (for example payer's username)? I cant force my users to use the same email address for paypal (which is originally returned by paypal) as they use on my site. Passing an additional username would be a great help for easily checking the payer's identity.

推荐答案

您可以在发布到 PayPal 的表单中包含自定义隐藏字段,如下所示:

You can include a custom hidden field in the form that is posted to PayPal, like this:

<input type="hidden" name="custom" value="<?php echo $user_name; ?>">  // I don't know php well, so correct that part if it's wrong

然后,PayPal 会将该值与其余的 IPN 数据一起传回给您.请注意,此字段允许的最大字符数为 256.

PayPal will then pass that value back to you with the rest of the IPN data. Note that the maximum number of characters permitted for this field is 256.

此外,您不能只定义任何字段 - 您只能使用 PayPal 指定的字段 此处(即输入 name 是自定义",因为 PayPal 特别允许 - 如果您有将 name 设置为 'username' 它将被忽略).

Also, you can't define just any field - you can only use the ones that PayPal specifies here (i.e. the input name is 'custom' because PayPal specifically allows it - if you had set the name to 'username' it would be ignored).

相关文章