vitr / laravel-jvzoo by vitr

JVZoo IPN for Laravel 5.2
50
1
3
Package Data
Maintainer Username: vitr
Maintainer Contact: vitdotonline@gmail.com (vitr)
Package Create Date: 2016-09-12
Package Last Update: 2016-09-15
Language: PHP
License: Unknown
Last Refreshed: 2024-05-03 03:05:33
Package Statistics
Total Downloads: 50
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 3
Total Forks: 0
Total Open Issues: 0

JVZoo IPN for Laravel 5.2

Installation

1. Include laravel-jvzoo as a dependency in composer.json:

$ composer require vitr/laravel-jvzoo

2. Add the ServiceProvider to your provider array within config/app.php

'providers' => [
	...
	vitr\Jvzoo\JvzooServiceProvider::class,
	...
]

3. Add your JVZoo API secret key to .env

JVZOO_KEY=*************

Usage

Listen to JVZoo events by adding event listeners to routes.php

Event::listen('jvzoo', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.sale', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.bill', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.rfnd', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.cgbk', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.insf', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.cancel.rebill', function( $data ) { /* INSERT CODE HERE */ });
Event::listen('jvzoo.uncancel.rebill', function( $data ) { /* INSERT CODE HERE */ });

Example

Event::listen('jvzoo.sale', function( $data ) { 

	$password = str_random(12);

	User::create([
        'name' => $data['ccustname'],
        'email' => $data['ccustemail'],
        'password' => bcrypt($password),
    ]);

});

Event::listen('jvzoo.cancel.rebill', function( $data ) { 

	if ($user = \App\User::where('email', '=', $data['ccustemail'])->first())
		$user->delete();

});

inspired by https://github.com/kjellberg/laravel-jvzoo