Skip to content

Commit daad8d6

Browse files
author
Konstantinos Christofilos
committed
Parse webhook notifications
1 parent a56b463 commit daad8d6

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ $customer = $gateway->createCustomer([
6262
```
6363
You can find full list of options [here](https://developers.braintreepayments.com/reference/request/customer/create/php).
6464

65-
###Find Customer (By id)
65+
###Find customer (By id)
6666

6767
```php
6868
$customer = $gateway->findCustomer(1)->send();
@@ -82,6 +82,23 @@ $subscription = $gateway->createSubscription([
8282
```
8383
You can find full list of options [here](https://developers.braintreepayments.com/reference/request/subscription/create/php)
8484

85+
###Cancel subscription
86+
87+
```php
88+
$subscription = $gateway->cancelSubscription('id')->send();
89+
```
90+
You can find full list of options [here](https://developers.braintreepayments.com/reference/request/subscription/cancel/php)
91+
92+
###Parse webhook notification
93+
94+
```php
95+
$notification = $gateway->parseNotification([
96+
'bt_signature' => 'signature',
97+
'bt_payload' => 'payload'
98+
])->send();
99+
```
100+
You can find full list of options [here](https://developers.braintreepayments.com/guides/webhooks/parse/php)
101+
85102
## Support
86103

87104
If you are having general issues with Omnipay, we suggest posting on

src/Gateway.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,19 @@ public function cancelSubscription($subscriptionId)
249249
{
250250
return $this->createRequest('\Omnipay\Braintree\Message\CancelSubscriptionRequest', array('id' => $subscriptionId));
251251
}
252+
253+
/**
254+
* @param array $parameters
255+
*
256+
* @return \Braintree_WebhookNotification
257+
*
258+
* @throws \Braintree_Exception_InvalidSignature
259+
*/
260+
public function parseNotification(array $parameters = array())
261+
{
262+
return \Braintree_WebhookNotification::parse(
263+
$parameters['bt_signature'],
264+
$parameters['bt_payload']
265+
);
266+
}
252267
}

0 commit comments

Comments
 (0)