1. Go to this page and download the library: Download squipix/laravel-paystack 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/ */
/**
* In the case where you need to pass the data from your
* controller instead of a form
* Make sure to send:
* eference" => '4g4g5485g8545jg8gj',
"email" => '[email protected]',
"currency" => "NGN",
"orderID" => 23456,
);
$response = Paystack::transaction()->initialize($data);
return redirect($response['data']['authorization_url']);
/**
* Initialize a new transaction for a customer.
*
* @param array $data {
* @type string $email Customer's email address (reference (optional - auto-generated if omitted).
* @type string $callback_url URL to redirect to after payment (optional).
* @type array $metadata Custom metadata including custom_fields (optional).
* }
* @return array Response from Paystack API.
*/
Paystack::transaction()->initialize(array $data);
/**
* Verify the status of a transaction using its reference.
*
* @param string $ref Unique transaction reference to verify.
* @return array Response from Paystack API containing transaction details.
*/
Paystack::transaction()->verify(string $ref);
/**
* Fetch details of a single transaction by its ID or reference.
*
* @param string $id_or_ref Optional transaction ID or reference.
* @return array Response with transaction details.
*/
Paystack::transaction()->fetch(string $id_or_ref);
/**
* List all transactions for the authenticated Paystack account.
*
* @return array Paginated list of transactions.
*/
Paystack::transaction()->list();
/**
* Charge a customer using a saved authorization code.
*
* @param array $data {
* @type string $authorization_code The saved Paystack authorization code (