简体   繁体   English

给PayPal现在购买按钮专用ID?

[英]Give PayPal buy now button special ID?

I have a service I am starting where it's paid.我有一项服务,我从付费的地方开始。 I want to give a PayPal payment a special id.我想给 PayPal 付款一个特殊的 ID。 The ID would be passed through IPN and I could read it so I can modify my mysql database with that special ID.该 ID 将通过 IPN 传递,我可以读取它,因此我可以使用该特殊 ID 修改我的 mysql 数据库。 If that all makes sense...如果这一切都有意义...

I am basically want to upgrade their account without having to do some complicated process which I have already tried where it would send the user the transaction ID and they would have to go to a special URL to change their account information.我基本上想升级他们的帐户,而不必执行一些我已经尝试过的复杂过程,它将向用户发送交易 ID,他们必须将 go 转换为特殊的 URL 来更改他们的帐户信息。

See what I mean?明白了吗? How would I go about doing this?我将如何 go 这样做?

Thanks, Coulton谢谢,库尔顿

If anyone else has a question on how to do it, I've found a way to fix it.如果其他人对如何做到这一点有疑问,我已经找到了解决它的方法。 When making your button, include this:制作按钮时,请包括以下内容:

<input type='hidden' name='notify_url' value='http://yourdomain.com/paypal/ipn.php?user_id=$user_id'>

So you can pass who has made the payment to the IPN via get.因此,您可以通过 get 将付款人传递给 IPN。 Simply use $_GET['user_id'] to get the data (in my case a user_id).只需使用$_GET['user_id']来获取数据(在我的例子中是 user_id)。 You can pass any variables you wish!你可以传递任何你想要的变量!

I played around with this for ages before I have realized that you can only send the pre defined paypal variables and not make your own up.在我意识到您只能发送预定义的 paypal 变量而不是自己制作之前,我玩了很多年。

These are listed here https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside这些在此处列出https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside

One you can use for a custom variable is called 'custom'可用于自定义变量的一种称为“自定义”

<input type="hidden" name="custom" value="<?=$twitId;?>">

You also need to ensure you use this button您还需要确保使用此按钮

<input type="hidden" name="cmd" value="_s-xclick">

You also need to turn on and set a URL for the Instant Payment Notification on PayPal您还需要为 PayPal 上的即时付款通知打开并设置 URL

They call this as a listener but it really just sends the payment data to the paypal page.他们称之为监听器,但它实际上只是将支付数据发送到 paypal 页面。 Note this is not the URL the customer is returned to after payment completion as set in button preferences.请注意,这不是按钮首选项中设置的付款完成后客户返回的 URL。

Retrieve the custom variable in PHP thus因此检索 PHP 中的自定义变量

$userID = $_POST[custom];

Full instructions here http://www.brianmoreau.com/articles/paypal_buy_now_button_sending_custom_variables.php完整的说明在这里http://www.brianmoreau.com/articles/paypal_buy_now_button_sending_custom_variables.php

Hope this saves you the many hours I spent on it.希望这可以为您节省我花在上面的时间。

This method also allows you to obtain the buyer details such as email and address and the transaction reference.此方法还允许您获取买家详细信息,例如 email 和地址以及交易参考。

To view the full data paypal sends after payment by clicking on history, IPN history要查看 paypal 在付款后通过单击历史记录、IPN 历史记录发送的完整数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM