Integrate noon payment API with Laravel
codebuglab/noon-payment-laravel is a Laravel package for integrate noon payment api with laravel.
It currently has 15 GitHub stars and 8.591 downloads on Packagist (latest version v0.0.8).
Install it with composer require codebuglab/noon-payment-laravel.
Discover more Laravel packages by codebuglab
or browse all Laravel packages to compare alternatives.
Last updated
Integrate NoonPayment API with Laravel

To install this package through composer run the following command in the terminal
composer require codebuglab/noon-payment-laravel
Refer to Noon docs to get your info then add them to .env file
NOON_PAYMENT_BUSINESS_ID=
NOON_PAYMENT_APP_NAME=
NOON_PAYMENT_APP_KEY=
NOON_PAYMENT_TOKEN_IDENTIFIER=
NOON_PAYMENT_RETURN_URL=http://127.0.0.1:8000/noon_payment_response
# Change the mode to Live for the Production or set it as Test
NOON_PAYMENT_MODE=Test
# Pre-configured order route categories (the categories will be mentioned also in the initial setup email)
NOON_PAYMENT_ORDER_CATEGORY=
# Channels are pre-defined and limited to Web / Mobile (the channels will be mentioned also in the initial setup email)
NOON_PAYMENT_CHANNEL=web
# Default value - Payment API Endpoint - Chooses
# https://api.noonpayments.com/payment/v1/
# https://api-test.noonpayments.com/payment/v1/
NOON_PAYMENT_PAYMENT_API=https://api-test.noonpayments.com/payment/v1/
Run this command in terminal to publish package files in your app
php artisan vendor:publish --provider="CodeBugLab\NoonPayment\NoonPaymentServiceProvider"
This will publish 2 files
1- App/Http/Controllers/NoonPaymentController.php
2- config/noon_payment.php
noon_payment.php config file and set package configuration on this file instead of .env if you wantphp artisan vendor:publish --provider="CodeBugLab\NoonPayment\NoonPaymentServiceProvider" --tag=controller
NoonPaymentController.php is a simple example to use it in your project, consider it as a demo.This package has two routes using NoonPaymentController.php file
http://yourwebsite/noon_payment
Which call function ( NoonPaymentController@index ) by GET Request
http://yourwebsite/noon_payment_response
Which receive a GET response through function ( NoonPaymentController@response )
the link for test cards by official documentation => Test Cards
$data =[
"order" => [
"reference" => "1",
"amount" => "10",
"currency" => "SAR",
"name" => "Sample order name",
],
"configuration" => [
"locale" => "en"
]
]
$response = NoonPayment::getInstance()->initiate($data);
if ($response->resultCode == 0) {
return redirect($response->result->checkoutData->postUrl);
}
.env file like thisNOON_PAYMENT_RETURN_URL=http://127.0.0.1:8000/noon_payment_response
$response = NoonPayment::getInstance()->getOrder($orderId);
$response variable like thisif (
$response->result->transactions[0]->type == "SALE" &&
$response->result->transactions[0]->status == "SUCCESS"
) {
//success Message
}
NoonPaymentController.php file.Refund or Cancel for order then this package doesn't provide these methods yet, So we highly recommend to read full Documentation before try this and making a pull request.This package is a free software distributed under the terms of the MIT license.