1. Go to this page and download the library: Download astimpay/laravel-sdk 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/ */
astimpay / laravel-sdk example snippets
use AstimPay\LaravelSDK\AstimPay;
$apiKey = "4a59f023cbc02521417f21a0add4e028febb2ca8"; // API KEY
$apiBaseURL = "https://sandbox.astimpay.com/api/checkout-v1"; // API URL
$astimpay = new AstimPay($apiKey, $apiBaseURL);
// Example request data for initializing a payment
$requestData = [
'full_name' => "John Doe",
'email' => "[email protected]",
'amount' => 100,
'metadata' => [
'example_metadata_key' => "example_metadata_value",
// ... Add more key-value pairs for dynamic metadata ...
],
'redirect_url' => 'http://localhost/success.php', // add your success route
'return_type' => 'GET',
'cancel_url' => 'http://localhost/cancel.php', // add your cancel route
'webhook_url' => 'http://localhost/ipn.php', // add your ipn route
];
try {
$paymentUrl = $astimpay->initPayment($requestData);
return redirect($paymentUrl);
} catch (\Exception $e) {
dd("Initialization Error: " . $e->getMessage());
}