doudu4282 2012-05-04 15:17
浏览 75
已采纳

将PayPal“捐赠”按钮链接到Wordpress“发表评论”按钮

I am using a Wordpress template to serve as a system to collect verbal bids, really post comments, that will cost visiters to the site $1 to make. I've changed the standard "Post Comment" text at the end of posts to "Submit Bid".

I've also installed a PayPal donation plugin that displays a "Donate" button on the page.

I want to combine the functionality of both of these buttons into one button, the "Submit Bid" button. To be clear, the Submit Bid button posts the user's comment to the post page; I need a button that does this while simultaneously directing the user to PayPal to donate the $1.

Ideally, I'd have a check in place to verify that the user actually paid the $1 in order for the bid to be submitted, but since this is more complicated, and because this is for charitable purposes, I am putting faith in my users to actually pay. After the donation, PayPal will redirect them to the page to which they submit their verbal bid ("comment").

The php for the "Submit Bid" button looks like (it's from the standard "comments.php of the typical wordpress blog):

<input type="submit" value="Submit Bid" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

The PayPal "Donate" button is a plugin actually placed on the page as a function:

<?php echo Paypal_payment_accept(); ?>

The function code is quite long, but the code placing the actual "Donate" button on the page is:

$output .= "<input type=\"image\" src=\"$payment_button\" name=\"submit\" alt=\"Make payments with payPal - it's fast, free and secure!\" />";

Would greatly appreciate thoughts on how to solve this seemingly trivial problem!

  • 写回答

2条回答 默认 最新

  • douzhoubing2805 2012-05-04 17:25
    关注

    Actually, there might be a simpler way, rather than using the Paypal submission using a form.

    Keep the redirect code, but edit the $location variable to be the URL that takes the user to paypal, with all the variables you want to send to them, eg: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=email%40paypalhacks%2Ecom&amount=1%2E00&currency_code=USD&item_name=donation&item_number=1001&quantity=1&shipping=3%2E00&no_shipping=0

    So it will process the comment normally, and then send the user to the paypal page to make the payment. You can go to that URL in your browser to check it works. Probably add a 'return' variable as well to send the user back to the original $location value, so the user will get to the comment page upon successful payment to paypal.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果