49.gif

Search (advanced search)
Use this Search form before posting, asking or make a new thread.
Tips: Use Quotation mark to search words (eg. "How To Make Money Online")

02-21-2016, 12:02 PM
Post: #1
[WTB] Braintree Payment PHP Webhook
Hi Guys,

I am trying to create a webhook for Braintree for the Disbursements. I am using WordPress and below is the code I am using but getting the following error:

"Fatal error: Class 'Braintree_Configuration' not found in /public_html/domain name/Braintree.php on line 4"

<?php
require_once('Braintree.php');

Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('#');
Braintree_Configuration::publicKey('#');
Braintree_Configuration::privateKey('#');

$bt_challenge_param = $_GET['bt_challenge'];
echo $response = Braintree_WebhookNotification::verify($bt_challenge_param);

if(
isset($_POST["bt_signature"]) and&
isset($_POST["bt_payload"])
) {
$webhookNotification = Braintree_WebhookNotification::parse(
$_POST["bt_signature"], $_POST["bt_payload"]
);
$message =
"[Webhook Received " . $webhookNotification->timestamp->format('Y-m-d H:i:s') . "] "
. "Kind: " . $webhookNotification->kind . " | "
. "Subscription: " . $webhookNotification->disbursement->id . "\n";
file_put_contents("/tmp/webhook.log", $message, FILE_APPEND);
}

?>

Thanks




18.gif
Free counters!