To initiate a payment request through the SISP payment gateway, you'll need to provide the following essential information:
amount
: The total amount to be paid.transactionId
: A unique identifier for the transaction, which can be used to track the payment in your system.options
: An optional array of additional parameters that can be passed to the payment request. This can include things like currency, description, or any other relevant data.
You can trigger the payment request in two ways: using the Sisp
facade or by making a post request.
Using the Sisp
Facade
The simplest way to request a payment is by calling the requestPayment
method via the Sisp
facade, passing in the required amount
and transactionId
parameters. This method will handle the payment request and redirect the user to the SISP payment page.:
Sisp::requestPayment(amount: $amount, transactionId: $transactionId);
with the optional options
parameter:
Sisp::requestPayment(amount: $amount, transactionId: $transactionId, options: $options);
Using a Form Submission
Alternatively, you can set up a form that triggers the payment request by posting to a specific route. This method allows you to provide the payment amount directly in the user interface.
<!-- Example: Blade template for payment form -->
<form action="{{ route('test') }}" method="POST">
@csrf
<input name="amount" type="number" required placeholder="Enter amount" />
<input name="transactionId" type="text" type="hidden"/>
<button type="submit">Pay Now</button>
</form>
// Example: routes/web.php
Route::post('/test', function () {
$amount = request('amount');
$transactionId = request('transactionId');
Sisp::requestPayment(amount: $amount, transactionId: $transactionId);
});
// Example: Controller
class PaymentController extends Controller
{
public function requestPayment(Request $request)
{
// Validate the request data
$amount = Request::input('amount');
$transactionId = Request::input('transactionId');
Sisp::requestPayment(amount: $amount, transactionId: $transactionId);
}
}
After the payment request is made, the user will be redirected to the payment page hosted by SISP to complete the transaction. Once the payment is successfully processed or any changes are made, the system will notify your application accordingly.