PHP code example of aerni / snipcart-webhooks

1. Go to this page and download the library: Download aerni/snipcart-webhooks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aerni / snipcart-webhooks example snippets


return [

    /*
    |--------------------------------------------------------------------------
    | Snipcart API Keys
    |--------------------------------------------------------------------------
    |
    | Your secret Snipcart API Keys for the Live and Test Environment.
    |
    */

    'live_secret' => env('SNIPCART_LIVE_SECRET'),
    'test_secret' => env('SNIPCART_TEST_SECRET'),

    /*
    |--------------------------------------------------------------------------
    | Test Mode
    |--------------------------------------------------------------------------
    |
    | Set this to 'false' to authenticate using the 'live_secret'.
    | You probably want to do this in production only.
    |
    */

    'test_mode' => env('SNIPCART_TEST_MODE', true),

];

Route::snipcart('webhook-receiving-url');

public function handle(OrderCompleted $payload)
{
    $payload;
}

public function handle(OrderStatusChanged $payload)
{
    $payload;
}

public function handle(OrderPaymentStatusChanged $payload)
{
    $payload;
}

public function handle(OrderTrackingNumberChanged $payload)
{
    $payload;
}

public function handle(OrderRefundCreated $payload)
{
    $payload;
}

public function handle(OrderNotificationCreated $payload)
{
    $payload;
}

public function handle(SubscriptionCreated $payload)
{
    $payload;
}

public function handle(SubscriptionCancelled $payload)
{
    $payload;
}

public function handle(SubscriptionPaused $payload)
{
    $payload;
}

public function handle(SubscriptionResumed $payload)
{
    $payload;
}

public function handle(SubscriptionInvoiceCreated $payload)
{
    $payload;
}

public function handle(InvalidSignature $request)
{
    $request;
}
bash
php artisan vendor:publish --provider="Aerni\SnipcartWebhooks\SnipcartWebhooksServiceProvider"