Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

php - Redirection to the original site after purchase is completed in Paypal

I'm making one web app. I've integrated Paypal in it using simple form submission to the Paypal site. Everything works well. but whenever the payment gets successful it should redirect back to my original site with the response from Paypal. However, it's not working as it should be. Currently it stays on the Paypal site only.

<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='form'>
 <input type='hidden' name='business' value='<?php echo $paypal_id; ?>'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' id='item_name' value=''>
<input type='hidden' name='item_number' id='item_number' value=''>
<input type='hidden' name='amount' id='amount' value=''>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='cancel_return' value='http://yoursite.com/cancel.php'>
<input type='hidden' name='return' value='http://mysite.com/user_credits/purchase_credits'>
<input type="image" src="https://paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit">

what am I missing in it? I'm using CakePHP 2.0.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

You have to enable auto return functionality setting in paypal .

Just follow the below steps to enable

  1. Log in and click the Profile subtab under My Account.
  2. Click the Website Payment Preferences link under Selling Preferences.
  3. Click the On radio button to enable Auto Return.
  4. Enter the Return URL. Note: You must meet the Return URL requirements in order to set up Auto Return. Learn more about Return URL.

For sandbox account do the following

  1. Log in to the Sandbox Merchant Id and click the Profile subtab under My Account.
  2. Click the More Option link under Profile.
  3. Look Selling Preferences which is third row.
  4. Click the Website Payment Preferences link under Selling Preferences
  5. Click the On radio button to enable Auto Return.
  6. Click the On radio button to enable Auto Return.
  7. Enter the Return URL. Note: You must meet the Return URL requirements in order to set up Auto Return. Learn more about Return URL.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...