Paypal 贝宝自动返回不工作
自动返回已启用,捐款将被张贴,但用户必须单击黄色的“返回协调员”按钮才能返回。如果您认为这段代码有任何错误,请告诉我 另外,我不想使用自定义按钮Paypal 贝宝自动返回不工作,paypal,paypal-sandbox,donations,Paypal,Paypal Sandbox,Donations,自动返回已启用,捐款将被张贴,但用户必须单击黄色的“返回协调员”按钮才能返回。如果您认为这段代码有任何错误,请告诉我 另外,我不想使用自定义按钮 <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="email@gmail.com">
<!-- Specify a Donate button. -->
<input type="hidden" name="cmd" value="_donations">
<!-- Specify details about the contribution -->
<input type="hidden" name="item_name" value="@Resources.Donations.Strings.ThankYou">
<input type="hidden" name="return" value="http://www.return.com/thankyou"/>
<input type="hidden" name="cancel_return" value="http://www.return.com/cancel"/>
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="item_number" value="5.00">
<select name="amount" onchange="$('input[name=item_number]').val($(this).val())">
<option value="1.00">$1.00</option>
<option value="5.00" selected>$5.00</option>
<option value="10.00">$10.00</option>
<option value="15.00">$15.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
<option value="">@Resources.Donations.Labels.Other</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<button type="submit" name="submit" class="btn btn-large btn-paypal"></button>
</form>
$1.00
$5.00
$10.00
$15.00
$25.00
$50.00
@资源、捐赠、标签、其他
正如Andrew所建议的,我重构了代码以使用IPN。以下是我开始使用的一些代码。。这是一些带有日志记录的代码,可以帮助您开始
HTML格式:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="donations@myemail.org">
<!-- Specify a Donate button. -->
<input type="hidden" name="cmd" value="_donations">
<!-- Specify details about the contribution -->
<input type="hidden" name="item_name" value="@Resources.Donations.Strings.ThankYou">
<input type="hidden" name="return" value="auto_return_url_here"/>
<input type="hidden" name="notify_url" value="IPN_notify_url_here"/>
<input type="hidden" name="cancel_return" value="user_clicked_cancel_url_here"/>
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="item_number" value="5.00">
<select name="amount" onchange="$('input[name=item_number]').val($(this).val())">
<option value="1.00">$1.00</option>
<option value="5.00" selected>$5.00</option>
<option value="10.00">$10.00</option>
<option value="15.00">$15.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
<option value="">Other</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<button type="submit" name="submit" class="btn btn-large btn-paypal"></button>
</form>
以下是具有变量名的PayPalmModel:
public class PayPalModel
{
public string mc_gross { get; set; }
public string protection_eligibility { get; set; }
public string address_status { get; set; }
public string payer_id { get; set; }
public string tax { get; set; }
public string address_street { get; set; }
public string payment_date { get; set; }
public string payment_status { get; set; }
public string charset { get; set; }
public string address_zip { get; set; }
public string first_name { get; set; }
public string address_country_code { get; set; }
public string address_name { get; set; }
public string notify_version { get; set; }
public string custom { get; set; }
public string payer_status { get; set; }
public string address_country { get; set; }
public string address_city { get; set; }
public string quantity { get; set; }
public string payer_email { get; set; }
public string verify_sign { get; set; }
public string txn_id { get; set; }
public string payment_type { get; set; }
public string payer_business_name { get; set; }
public string last_name { get; set; }
public string address_state { get; set; }
public string receiver_email { get; set; }
public string pending_reason { get; set; }
public string txn_type { get; set; }
public string item_name { get; set; }
public string mc_currency { get; set; }
public string item_number { get; set; }
public string residence_country { get; set; }
public string test_ipn { get; set; }
public string transaction_subject { get; set; }
public string payment_gross { get; set; }
public string merchant_return_link { get; set; }
public string auth { get; set; }
public string ipn_track_id { get; set; }
}
您是否在PayPal帐户中启用了自动返回功能,并在此处包含参数?你确定你等得够久吗?即使启用AR,返回也可能需要5-10秒。请注意,如果您的返回URL上出现任何支付后处理代码,您将希望将其移动到IPN脚本中,以便始终保证运行。嗨,Andrew。是的,AR是启用的(只是检查了一下,它是启用的),并且没有特殊的后处理,除了异步地将事务细节保存在数据库中,这样客户端就不会被延迟。现在我将AR URL更改为其他内容(在域内),但仍然没有发生任何事情。AR URL必须是HTTPS吗?当我点击“返回捐款协调员”按钮时,Firefox向我发出警告,并说连接已加密,“你确定要重定向”之类的话。。
public class PayPalModel
{
public string mc_gross { get; set; }
public string protection_eligibility { get; set; }
public string address_status { get; set; }
public string payer_id { get; set; }
public string tax { get; set; }
public string address_street { get; set; }
public string payment_date { get; set; }
public string payment_status { get; set; }
public string charset { get; set; }
public string address_zip { get; set; }
public string first_name { get; set; }
public string address_country_code { get; set; }
public string address_name { get; set; }
public string notify_version { get; set; }
public string custom { get; set; }
public string payer_status { get; set; }
public string address_country { get; set; }
public string address_city { get; set; }
public string quantity { get; set; }
public string payer_email { get; set; }
public string verify_sign { get; set; }
public string txn_id { get; set; }
public string payment_type { get; set; }
public string payer_business_name { get; set; }
public string last_name { get; set; }
public string address_state { get; set; }
public string receiver_email { get; set; }
public string pending_reason { get; set; }
public string txn_type { get; set; }
public string item_name { get; set; }
public string mc_currency { get; set; }
public string item_number { get; set; }
public string residence_country { get; set; }
public string test_ipn { get; set; }
public string transaction_subject { get; set; }
public string payment_gross { get; set; }
public string merchant_return_link { get; set; }
public string auth { get; set; }
public string ipn_track_id { get; set; }
}