PHP code example of hypejunction / hypebraintreepayments

1. Go to this page and download the library: Download hypejunction/hypebraintreepayments library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hypejunction / hypebraintreepayments example snippets


elgg_register_plugin_hook_handler('subscription_went_past_due', 'braintree', HandleExpiredSubscription::class);

class HandleExpiredSubscription {
	public function __invoke(\Elgg\Hook $hook) {
		$webhook = $hook->getParam('webhook');
		/* @var $webhook \Briantree\WebhookNotification */
		
		// ... do stuff
		
		return $result; // data to send back to braintree
	}
}


// Card number, expiry and CVC
echo elgg_view_field([
	'#type' => 'braintree/card',
	'#label' => 'Credit or Debit Card',
	'

$token = get_input('braintree_token'); // Corresponds to payment_method_nonce

elgg()->{'payments.gateways.braintree'}->pay($transaction, [
	'braintree_token' => $token,
]);