vitr/laravel-jvzoo

There is no license information available for the latest version (v1.0.1) of this package.

JVZoo IPN for Laravel 5.2

v1.0.1 2016-09-15 10:39 UTC

This package is not auto-updated.

Last update: 2024-11-23 20:42:21 UTC


README

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