Created
March 5, 2021 16:36
-
-
Save ideadude/cc026d39003b07ca9a81ff1544b676e4 to your computer and use it in GitHub Desktop.
Testing the PMPro Braintree using the signature and payload from a webhook log.
This file contains hidden or 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 | |
/** | |
* Add this function into a customizations plugin | |
* and then visit yoursite.com/wp-admin/?test_braintree_webhook=1 from a browser. | |
*/ | |
function init_test_braintree_webhook() { | |
if(!empty($_REQUEST['test_braintree_webhook'])) { | |
define('PMPRO_BRAINTREE_WEBHOOK_DEBUG', true); | |
$_POST['bt_signature'] = 'putthesignaturefromthewebhookloghere'; | |
$_POST['bt_payload'] = 'putthepayloadfromthewebhookloghereitsreallylong'; | |
$_REQUEST['bt_signature'] = $_POST['bt_signature']; | |
$_REQUEST['bt_payload'] = $_POST['bt_payload']; | |
require_once(PMPRO_DIR . "/services/braintree-webhook.php"); | |
exit; | |
} | |
} | |
add_action('init', 'init_test_braintree_webhook'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment