/home/kueuepay/public_html/database/seeders/Admin/BasicSettingsSeeder.php
<?php

namespace Database\Seeders\Admin;

use Exception;
use Illuminate\Database\Seeder;
use App\Models\Admin\BasicSettings;

class BasicSettingsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $data = [
            'site_name'         => "NFCPay",
            'site_title'        => "Contactless Payment System",
            'base_color'        => "#00ab83",
            'secondary_color'   => "#262626",
            'otp_exp_seconds'   => "3600",
            'timezone'          => "Asia/Dhaka",
            'user_registration' => 1,
            'agree_policy'      => 1,
            'broadcast_config'  => [
                "method"        => "pusher", 
                "app_id"        => "1574360", 
                "primary_key"   => "971ccaa6176db78407bf", 
                "secret_key"    => "a30a6f1a61b97eb8225a", 
                "cluster"       => "ap2" 
            ],
            'push_notification_config'  => [
                "method"                => "pusher", 
                "instance_id"           => "fd7360fa-4df7-43b9-b1b5-5a40002250a1", 
                "primary_key"           => "6EEDE8A79C61800340A87C89887AD14533A712E3AA087203423BF01569B13845"
            ],
            'kyc_verification'  => true,
            'mail_config'       => [
                "method"        => "smtp", 
                "host"          => "appdevs.team",
                "port"          => "465", 
                "encryption"    => "ssl",
                "username"      => "system@appdevs.net",
                "password"      => "QP2fsLk?80Ac",
                "from"          => "system@appdevs.net", 
                "mail_address"  => "system@appdevs.net", 
                "app_name"      => "NFCPay",
            ],
            'email_verification'    => true,
            'site_logo_dark'        => "seeder/logo.png",
            'site_logo'             => "seeder/logo.png",
            'site_fav_dark'         => "seeder/favicon.png",
            'site_fav'              => "seeder/favicon.png",
            'app_launcher_dark'     => "seeder/app-launcher.png",
            'app_launcher'          => "seeder/app-launcher.png",
            'web_version'           => "1.0.0",
        ];

        try{
            $basic_data     = BasicSettings::firstOrCreate($data);
            $env_modify_keys = [
                "MAIL_MAILER"       => $basic_data->mail_config->method,
                "MAIL_HOST"         => $basic_data->mail_config->host,
                "MAIL_PORT"         => $basic_data->mail_config->port,
                "MAIL_USERNAME"     => $basic_data->mail_config->username,
                "MAIL_PASSWORD"     => $basic_data->mail_config->password,
                "MAIL_ENCRYPTION"   => $basic_data->mail_config->encryption,
                "MAIL_FROM_ADDRESS" => $basic_data->mail_config->mail_address,
                "MAIL_FROM_NAME"    => $basic_data->mail_config->app_name,
                "PUSHER_APP_ID"     => $basic_data->broadcast_config->app_id,
                "PUSHER_APP_KEY"    => $basic_data->broadcast_config->primary_key,
                "PUSHER_APP_SECRET" => $basic_data->broadcast_config->secret_key,
            ];
            modifyEnv($env_modify_keys);
        }catch(Exception $e){}

        
    }
}
Initiate Payment

Initiate Payment

Initiates a new payment transaction.

Endpoint: POST create-order
Parameter Type Details
amount decimal Your Amount , Must be rounded at 2 precision.
currency string Currency Code, Must be in Upper Case (Alpha-3 code)
success_url string Enter your return or success URL
cancel_url string (optional) Enter your cancel or failed URL
                    
                        Request Example (guzzle)
                        

<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', $base_url.'create-order', [
'headers' => [
  'Authorization' => 'Bearer '. $authorizationToken,
  'accept' => 'application/json',
  'content-type' => 'application/json',
 ],
'form_params' => [
  'amount' => '$amount',
  'currency' => 'currency',
  'success_url' => 'success_url',
  'cancel_url' => 'cancel_url',
 ],
]);
echo $response->getBody();
                    
                        
**Response: SUCCESS (200 OK)**
{
 "message": {
 "success": [
  "Order created successfully."
 ]
},
"data": {
 "redirect_url":"https://example.com/login/OISADFDFSDFSF",
 "order_details":{
 "amount" : "10",
 "fixed_charge" : 2,
 "percent_charge" : 1,
 "total_charge" : 3,
 "total_payable" : 13,
 "currency" : "USD",
 "expiry_time": "2024-04-25T06:48:35.984285Z",
 "success_url": "http://127.0.0.1/nfcpay/user/transaction/success",
 "cancel_url": "http://127.0.0.1/nfcpay/user/transaction/cancel"
}
},
"type": "success"
}
                    
                        
**Response: ERROR (400 FAILED)**
{
 "message": {
 "error": [
  "Invalid token."
 ]
},
"data": null,
"type": "error"
}