/fpx

A Laravel implementation for Paynet FPX service

Primary LanguagePHPMIT LicenseMIT

Very short description of the package

This package provides laravel implementations for Paynet FPX services.

Installation

You can install the package via composer:

composer require aimensasi/fpx

Then run the publish command to publish the config files and support controller

php artisan vendor:publish --provider="Aimensasi\FPX\FPXServiceProvider"

Setups

  1. Add your redirect urls and your Seller and Exchange Id to the .env file.
FPX_INDIRECT_URL=https://app.test/payments/fpx/callback
FPX_INDIRECT_PATH=payments/fpx/callback
FPX_DIRECT_URL=https://app.test/payments/fpx/direct-callback
FPX_DIRECT_PATH=payments/fpx/direct-callback

FPX_EXCHANGE_ID=
FPX_SELLER_ID=
  1. After generating your certificates add them to your app. By default, we look for the certificates inside the following directives.
'certificates' => [
	'uat' => [
		'disk' => 'local', // S3 or Local. Don't put your certificate in public disk
		'dir' => '/certificates/uat',
	],
	'production' => [
		'disk' => 'local', // S3 or Local. Don't put your certificate in public disk
		'dir' => '/certificates/prod',
	]
],

You can override the defaults by updating the config file.

  1. Run migration to add the banks table
php artisan migrate

Usage

  1. First run the following commands to seed the banks list.
php artisan fpx:banks

you should schedule the fpx:banks Artisan command to run daily:

$schedule->command('fpx:banks')->daily();

Once the banks are seeded, you can add the pay component to your view.

 <x-fpx-pay
		:reference-id="$invoice->id"
		:datetime="$invoice->created_at->format('Ymdhms')"
		:amount="$invoice->total"
		:customer-name="$company->name"
		:customer-email="$company->owner->email"
		product-description="Salary Invoice">

During testing, you can use the test-mode attribute to override the provided amount to 'MYR 1.00'

 <x-fpx-pay
		:reference-id="$invoice->id"
		:datetime="$invoice->created_at->format('Ymdhms')"
		:amount="$invoice->total"
		:customer-name="$company->name"
		:customer-email="$company->owner->email"
		product-description="Salary Invoice"
		test-mode>

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email aimensasi@icloud.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.