PHP code example of johnrivera7 / filament-transbank-webpay
1. Go to this page and download the library: Download johnrivera7/filament-transbank-webpay 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/ */
johnrivera7 / filament-transbank-webpay example snippets
use JohnRivera7\FilamentTransbankWebpay\FilamentTransbankWebpayPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(
FilamentTransbankWebpayPlugin::make()
->navigationGroup('Pagos')
->navigationSort(40)
);
}
use JohnRivera7\FilamentTransbankWebpay\Support\TransbankCredentials;
->plugin(
FilamentTransbankWebpayPlugin::make()
->credentialsUsing(function (): TransbankCredentials {
$cfg = /* read from your DB */;
return TransbankCredentials::fromArray($cfg);
})
->persistCredentialsUsing(function (TransbankCredentials $credentials): void {
/* persist $credentials->toArray() */
})
)
if (WebpayPlusGateway::isAbortReturn($request->all())) {
$reason = WebpayPlusGateway::abortReason($request->all()); // aborted|timeout
}
// If token_ws is present (even alongside TBK_*), call commit:
$result = $gateway->commit($request->all());
use JohnRivera7\FilamentTransbankWebpay\Forms\Components\TransbankCredentialsSchema;
$schema->components([
...TransbankCredentialsSchema::make('payments.transbank'),
]);