PHP code example of mymage / saasykit-peachpayments

1. Go to this page and download the library: Download mymage/saasykit-peachpayments 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/ */

    

mymage / saasykit-peachpayments example snippets


use App\Services\PaymentProviders\PeachPayments\PeachPaymentsProvider;

// inside register(), extend the existing tag() call:
$this->app->tag([
    StripeProvider::class,
    PaddleProvider::class,
    // ... existing providers ...
    PeachPaymentsProvider::class, // <-- add this
], 'payment-providers');

public const PEACH_PAYMENTS_SLUG = 'peach-payments';

[
    'name' => 'Peach Payments',
    'slug' => PaymentProviderConstants::PEACH_PAYMENTS_SLUG,
    'type' => 'multi',
    'created_at' => now()->format('Y-m-d H:i:s'),
    'updated_at' => now()->format('Y-m-d H:i:s'),
],

'peachpayments' => [
    'entity_id' => env('PEACHPAYMENTS_ENTITY_ID'),
    'secret_token' => env('PEACHPAYMENTS_SECRET_TOKEN'),
    'client_id' => env('PEACHPAYMENTS_CLIENT_ID'),
    'client_secret' => env('PEACHPAYMENTS_CLIENT_SECRET'),
    'merchant_id' => env('PEACHPAYMENTS_MERCHANT_ID'),
    'recurring_entity_id' => env('PEACHPAYMENTS_RECURRING_ENTITY_ID'),
    'recurring_access_token' => env('PEACHPAYMENTS_RECURRING_ACCESS_TOKEN'),
    'test_mode' => env('PEACHPAYMENTS_TEST_MODE', true),
    'max_renewal_retries' => env('PEACHPAYMENTS_MAX_RENEWAL_RETRIES', 3),
],

'services.peachpayments.entity_id',
'services.peachpayments.secret_token',
'services.peachpayments.client_id',
'services.peachpayments.client_secret',
'services.peachpayments.merchant_id',
'services.peachpayments.recurring_entity_id',
'services.peachpayments.recurring_access_token',
'services.peachpayments.test_mode',

'services.peachpayments.secret_token',
'services.peachpayments.client_secret',
'services.peachpayments.recurring_access_token',

use App\Filament\Admin\Resources\PaymentProviders\Pages\PeachPaymentsSettings;

public static function getPages(): array
{
    return [
        // ... existing pages ...
        'peach-payments-settings' => PeachPaymentsSettings::route('/peach-payments-settings'), // <-- add this
    ];
}

use App\Http\Controllers\PaymentProviders\PeachPaymentsController;

Route::post('/payments-providers/peach-payments/webhook', [PeachPaymentsController::class, 'handleWebhook'])
    ->name('payments-providers.peachpayments.webhook');

Route::post('/payments-providers/peach-payments/checkout-result', [PeachPaymentsController::class, 'checkoutResult'])
    ->name('payments-providers.peachpayments.checkout-result');

Schedule::command('app:peachpayments-charge-renewals')->hourly()->withoutOverlapping();
bash
php artisan vendor:publish --tag=saasykit-peachpayments
bash
php artisan db:seed --class=PaymentProvidersSeeder
bash
php artisan vendor:publish --tag=saasykit-peachpayments-tests
php artisan test --filter=PeachPayments