Log in

hypeBraintreePayments

hypeBraintreePayments

A wrapper for Braintree's PHP SDK

Webhooks

Configure your Braintree application to send webhooks to /payments/braintree/webhooks" data-qualifier="url" rel="nofollow">https:///payments/braintree/webhooks

To digest a webhook, register a plugin hook handler:

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 Input

To display a card input:

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

You can then retrieve the value of the Braintree token in your action:

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

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

Package Releases

VersionRelease Date
hypeBraintreePayments 1.1.11.1.1
hypeBraintreePayments 1.1.01.1.0
hypeBraintreePayments 1.0.01.0.0

Changelog

1.1.1 (2018-07-06)

Bug Fixes

  • forms: use new ajax form api to promise briantree token (51c5cb5)

1.1.0 (2018-06-29)

Features

1.0.1 (2018-05-15)

1.0.0 (2018-03-19)

Features

  • releases: initial commit (335d968)

About

Dependencies

Requires
Elgg version >= 3.0
Plugin: hypePayments Any
Plugin: hypeAjax Any
Suggests
Plugin: hypeCountries Any