[英]Paypal IPN sending information if user made a payment or cancels a recurring payment
[英]How to display payment information with PayPal IPN WordPress
我使用wordpress插件-IPN PayPal,并且希望在带有付款的首页列表中显示。 我不会用这个贝宝钩。
<?php
add_action('paypal_ipn_for_wordpress_ipn_response_handler', 'process_recurring_handler', 10, 1);
function process_recurring_handler( $posted )
{
// Parse data from IPN $posted[] array
$first_name = isset($posted['first_name']) ? $posted['first_name'] : '';
$last_name = isset($posted['last_name']) ? $posted['last_name'] : '';
$mc_gross = isset($posted['mc_gross']) ? $posted['mc_gross'] : '';
$recurring_payment_id = isset($posted['recurring_payment_id']) ? $posted['recurring_payment_id'] : '';
$payer_email = isset($posted['payer_email']) ? $posted['payer_email'] : '';
$txn_id = isset($posted['txn_id']) ? $posted['txn_id'] : '';
/**
* At this point you can use the data to generate email notifications,
* update your local database, hit 3rd party web services, or anything
* else you might want to automate based on this type of IPN.
*/
}
?>
我将其添加到function.php中,但是如何将此调用显示在页面上的表中的适当数据? 我尝试过
<?php do_action('paypal_ipn_for_wordpress_ipn_response_handler')?>
但这是行不通的。 我太懒了,救命
当任何IPN到达您的站点时,您将在此处显示的挂钩/功能被触发。 您可以使用它基于被触发的IPN自动执行您自己的过程。 它不会在网站页面/帖子本身上显示任何内容。
如果要在页面/帖子内容上显示IPN数据,则需要使用插件提供的短代码。 在插件的开发人员指南中查看“简码”选项。
例如,如果要显示最后10条IPN记录,则可以使用以下短代码:
[paypal_ipn_list field1="txn_id" field2="payment_date" field3="first_name" field4="last_name" field5="mc_gross"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.