Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
165 views
in Technique[技术] by (71.8m points)

The correct way to get variables sent by PayPal to the return URL

I'm following the steps from this answer Paypal checkout return data to redirect buyers automatically to the return URL like this (as you can see the rm option is set to 2)

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="U74VBC2YUQS7E">
<input type="hidden" name="item_name" value="subscribe">
<input type="hidden" name="amount" value="100.00">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="return" value="RETURN URL FOR CONFIRMED PAYMENTS">
 <input type="hidden" name="currency_code" value="USD">
 <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

now I'm trying to set Auto Return in paypal account to redirect the buyer automatically to the return URL but there's no "Website Payment Preferences" option.

enter image description here

Second question: how to send custom variables and fetch them again using the return url like username, password..... any data entered by the user before paying so I can grab all the data like this

$payer_email = $_POST['payer_email'];
$amount = $_POST['mc_gross'];
$payment_status= $_POST['payment_status'];

so if the status is Completed and the returned amount is equal to the form amount I can use the returned email, username and password to create a paid account on my site

$username = $_POST['username'];
$password = $_POST['password'];

My idea is to use custom field like this

<input type="hidden" name="custom" value="user=username&password=encrypted-user-pass-with-sha1">

but I guess it's wrong as mentioned here amount of non-hosted paypal buy now buttin is not changing

Sorry for this long post and Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Manage Buttons. It's set on the button, not the account, or you can set it yourself in the form.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...