Created
August 22, 2022 12:39
-
-
Save dparker1005/755e7d03fc641e742fe1ce458ee8978d to your computer and use it in GitHub Desktop.
Creates a log at /paid-memberships-pro/logs/create_recurring_payments_profile_response.txt for whenever we create a recurring payment profile in PayPal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Copy from below here... | |
/* | |
* Creates a log at /paid-memberships-pro/logs/create_recurring_payments_profile_response.txt for whenever we create | |
* a recurring payment profile in PayPal. | |
* | |
* Useful for debugging a "Missing PROFILESTATUS" error or initial subscription orders in "error" status. | |
*/ | |
function my_pmpro_log_create_recurring_payments_profile_response( $response_arr, $method ) { | |
// Make sure that we are setting up a recurring payment profile in PayPal. | |
if ( 'CreateRecurringPaymentsProfile' !== $method ) { | |
return; | |
} | |
$logstr = "Logged On: " . date_i18n("m/d/Y H:i:s") . "\n"; | |
$logstr .= print_r( $response_arr, true ); | |
$logstr .= "\n-------------\n"; | |
$loghandle = fopen(PMPRO_DIR . "/logs/create_recurring_payments_profile_response.txt", "a+"); | |
fwrite($loghandle, $logstr); | |
fclose($loghandle); | |
} | |
add_action( 'pmpro_paypal_handle_http_post_response', 'my_pmpro_log_create_recurring_payments_profile_response', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment