Simple Membership Plugin › Forums › Simple Membership Plugin › Action hook swpm_payment_ipn_processed doesn't work for recurring paiements
- This topic has 8 replies, 3 voices, and was last updated 4 years, 1 month ago by admin.
-
AuthorPosts
-
July 19, 2019 at 7:23 am #18646testerParticipant
Dear,
Great plugin!
I tried out the swpm_payment_ipn_processed action hook on recurring paiements, but it is only triggered when the first paiement occurs, not when the recurring paiements occurs. Any idea how to fix this?
And can you also tell me what is the name of the array that is returned so I can capture the data?July 21, 2019 at 6:00 am #18649mbrsolutionModeratorHi, thank you for reaching out to us. I have submitted a message to the developers to investigate further your question.
Kind regards
July 22, 2019 at 7:19 am #18658adminKeymasterIt should get triggered both for the first payment and the recurring payments. Please enable the debug log feature of the plugin. Then after you receive a recurring payment, check the log file to see if you see the following line in the log file:
Transaction data saved.
The action hook is triggered just after that. So seeing that line in the log file means, it is getting executed.
February 5, 2020 at 2:45 pm #19739testerParticipantThanks for your answer.
Can you also tell me what the returned array contains as data? Can you give me an example of a returned array? Need to know what it contains and how it is fully returned to be able to use the returned data.February 5, 2020 at 10:27 pm #19745adminKeymasterWe don’t have example data for this. You can dump the array content to a file from your test script to see what you are receiving. Below is an example of how the $ipn_data array structure looks like:
$ipn_data[‘mc_gross’]
$ipn_data[‘first_name’]
$ipn_data[‘last_name’]
$ipn_data[‘payer_email’]
$ipn_data[‘membership_level’]
$ipn_data[‘txn_id’]
$ipn_data[‘subscr_id’]
$ipn_data[‘swpm_id’]
$ipn_data[‘ip’]
$ipn_data[‘custom’]
$ipn_data[‘gateway’]
$ipn_data[‘status’]February 6, 2020 at 11:00 am #19746testerParticipantGreat, thanks for the answer. Does the hook also work with test payments (sandbox mode)?
February 6, 2020 at 11:27 pm #19748adminKeymasterYes, that hook will be triggered for testmode transactions also.
February 7, 2020 at 9:34 am #19752testerParticipantWell it doesn’t seem to work. I created in stripe in test mode a payment, but no action was triggered.
This is my code in functions.php in WordPressadd_action('swpm_payment_ipn_processed', 'after_received_payment'); function after_received_payment($ipn_data) { $webmaster = "myemail@yahoo.com"; $subject = "Paiement received test function"; $msg = "Hello" . "\r\n"; $msg .= "test functions.php Simple membership". "\r\n\r\n"; $msg .= "Payer email :".$ipn_data['payer_email']."\r\n\r\n"; $msg .= "Custom data : ".$ipn_data['custom']."\r\n\r\n"; $msg .= "Gateway : ". $ipn_data['gateway']."\r\n\r\n"; $msg .= "Status : ".$ipn_data['status']."\r\n\r\n"; $msg .= "MC gross : ". $ipn_data['mc_gross']."\r\n\r\n"; wp_mail($webmaster, $subject, $msg );
}
Any suggestion how to make it work?
February 7, 2020 at 11:47 pm #19755adminKeymasterI can’t see any obvious mistakes in there. This custom coding troubleshooting is beyond the scope of this free support forum. It will need to be handled via a paid ticket option.
-
AuthorPosts
- You must be logged in to reply to this topic.