Skip to content

Latest commit

 

History

History
95 lines (78 loc) · 2.62 KB

Subscription.md

File metadata and controls

95 lines (78 loc) · 2.62 KB

Subscription

ABN-AMRO Tikkie v2 Laravel integration

General | Application | Subscription | PaymentRequest | Payment | Refund | Example


Create a subscription

We've implemented a default post route to [your_website]/api/tikkie/notification which will generate a Payment or Refund Event based on what's posted.

To use this route also add to your .env file, but you can always use your own route if you want.

TIKKIE_ADD_ROUTE=true
$tikkie->subscription()->create('https://[your_website]/api/tikkie/notification');

Input

Variable Type Description
url string URL for the payment notification.

Response

Method Type Description
getSubscriptionId() string Consumer key which is obtained after app registration on the ABN developer portal.

Listeners

When the application receives a notification (via our own route) an event will bee generated based on the input. To listen and react to this event you need to create the corresponding listeners and implement your own business logic.

php artisan make:listener TikkiePaymentListener -e \\Cloudmazing\\Tikkie\\Events\\TikkiePaymentEvent
php artisan make:listener TikkieRefundListener -e \\Cloudmazing\\Tikkie\\Events\\TikkieRefundEvent

Check if the see the events in the even list.

php artisan event:list

If the events don't show up in the list, you'll have to either add them:

  1. Turn on auto discovery in the EventServiceProvider. Add the following function in app\Providers\EventServiceProvider.php.
    /**
     * Determine if events and listeners should be automatically discovered.
     *
     * @return bool
     */
    public function shouldDiscoverEvents()
    {
        return true;
    }
  1. Manually in the ``app\Providers\EventServiceProvider.php```.
protected $listen = [
    Registered::class => [
        SendEmailVerificationNotification::class,
    ],
    Cloudmazing\Tikkie\Events\TikkiePaymentEvent::class => [
        App\Listeners\PaymentListener::class
    ],
    Cloudmazing\Tikkie\Events\TikkieRefundEvent::class => [
        App\Listeners\RefundListener::class
    ],
];

You can implement the business logic to handle the listener handle function.

Delete a subscription

$tikkie->subscription()->delete();

Input

Variable Type Description

Response

Method Type Description