Skip to content

Instantly share code, notes, and snippets.

@basst85
Created August 6, 2020 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basst85/af0e876aae0c35421730fbd752f810bf to your computer and use it in GitHub Desktop.
Save basst85/af0e876aae0c35421730fbd752f810bf to your computer and use it in GitHub Desktop.
Create new callback filter for bunq sub-account
<?php
use bunq\Context\ApiContext;
use bunq\Context\BunqContext;
use bunq\Model\Generated\Endpoint\User;
use bunq\Model\Generated\Endpoint\UserPerson;
use bunq\Model\Generated\Endpoint\NotificationFilterUrlMonetaryAccount;
use bunq\Model\Generated\Object\NotificationFilterUrl;
use bunq\Model\Core\NotificationFilterUrlMonetaryAccountInternal;
use bunq\Util\BunqEnumApiEnvironmentType;
require_once(__DIR__ . '/vendor/autoload.php');
$environmentType = BunqEnumApiEnvironmentType::PRODUCTION(); //SANDBOX or PRODUCTION
$apiKey = 'YOUR API-KEY'; // Replace with your API-key
$deviceDescription = 'YOUR_DEVICE'; // Replace with your device description
$permittedIps = []; // List the real expected IPs of this device or leave empty to use the current IP
$apiContext = ApiContext::create(
$environmentType,
$apiKey,
$deviceDescription,
$permittedIps
);
BunqContext::loadApiContext($apiContext);
$user = BunqContext::getUserContext()->getUserPerson();
$primaryMonetaryAccount = BunqContext::getUserContext()->getPrimaryMonetaryAccount();
$notificationFilter = new NotificationFilterUrl('MUTATION', 'https://www.your-domain.com/callback');
$createdNotificationFilter = NotificationFilterUrlMonetaryAccountInternal::createWithListResponse($primaryMonetaryAccount->getId(), [$notificationFilter])->getValue();
print_r($createdNotificationFilter);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment