1. Go to this page and download the library: Download rick20/faspay 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/ */
// Customer class example. You can apply to any model you want.
use Rick20\Faspay\CustomerInterface;
class Customer implements CustomerInterface
{
public function getFaspayCustomerNumber()
{
return 'customer-number';
}
public function getFaspayCustomerName()
{
return 'customer-name';
}
public function getFaspayCustomerEmail()
{
return 'customer-email';
}
public function getFaspayCustomerPhone()
{
return 'customer-phone';
}
public function getFaspayPreferredCurrency()
{
return 'customer-currency';
}
}
// Item class example. You can apply to any model you want.
use Rick20\Faspay\Payable;
class Item implements Payable
{
public function getPayableName()
{
return 'Product Name';
}
public function getPayablePrice()
{
return 300000;
}
}
// An example how to use the API.
Route::get('/', function () {
$customer = new Customer();
$payable = new Item();
$payment = Payment::performedBy($customer)
->via('web')
->payWith('tcash')
->addTax(10)
->addMiscFee(1000);
$payment->addItem($payable, 2);
$response = Faspay::registerPayment($payment);
return Faspay::redirectToPay($payment);
});
Route::get('/callback-notif', function(\Illuminate\Http\Request $request) {
return Faspay::notified($request, function(\Rick20\Faspay\Notification $notification) {
return $notification;
});
});
class TopupBillingProfile implements BillingProfileInterface
{
public function description()
{
return 'Topup Saldo';
}
public function generate(Payment $payment)
{
return str_random(15);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.