Chargily ePay Gateway PHP

Overview

Chargily ePay Gateway PHP

Chargily ePay Gateway

Make ePayment gateway integration with Chargily easier

  • Currently support payment by CIB / EDAHABIA cards and soon by Visa / Mastercard
  • This is a PHP package, If you are using another programing language Browse here or look to API documentation

Requirements

  1. PHP 7.2.5 and later.
  2. Get your API Key/Secret from ePay by Chargily dashboard for free

Installation

  1. Via Composer (Recomended)
composer require chargily/epay-gateway
  1. Download as ZIP We do not recommend this option. But be careful to download the updated versions every a while Download

Quick start

  1. create config file epay_config.php This is where store your api credentials
//  Configurations file
return [
    'key' => 'your-api-key', // you can you found it on your epay.chargily.com.dz Dashboard
    'secret' => 'your-api-secret', // you can you found it on your epay.chargily.com.dz Dashboard
];
  1. create payment redirection file redirect.php
"valid-url-to-receive-payment-informations", // this is where you receive payment informations ], //mode 'mode' => 'EDAHABIA', //OR CIB //payment details 'payment' => [ 'number' => 'payment-number-from-your-side', // Payment or order number 'client_name' => 'client name', // Client name 'client_email' => '[email protected]', // This is where client receive payment receipt after confirmation 'amount' => 75, //this the amount must be greater than or equal 75 'discount' => 0, //this is discount percentage between 0 and 99 'description' => 'payment-description', // this is the payment description ] ]); // get redirect url $redirectUrl = $chargily->getRedirectUrl(); //like : https://epay.chargily.com.dz/checkout/random_token_here // if($redirectUrl){ //redirect header('Location: '.$redirectUrl); }else{ echo "We cant redirect to your payment now"; }">
use Chargily\ePay\Chargily;

require 'path-to-vendor/vendor/autoload.php';

$epay_config = require 'epay_config.php';

$chargily = new Chargily([
    //credentials
    'api_key' => $epay_config['key'],
    'api_secret' => $epay_config['secret'],
    //urls
    'urls' => [
        'back_url' => "valid-url-to-redirect-after-payment", // this is where client redirected after payment processing
        'webhook_url' => "valid-url-to-receive-payment-informations", // this is where you receive payment informations
    ],
    //mode
    'mode' => 'EDAHABIA', //OR CIB
    //payment details
    'payment' => [
        'number' => 'payment-number-from-your-side', // Payment or order number
        'client_name' => 'client name', // Client name
        'client_email' => '[email protected]', // This is where client receive payment receipt after confirmation
        'amount' => 75, //this the amount must be greater than or equal 75 
        'discount' => 0, //this is discount percentage between 0 and 99
        'description' => 'payment-description', // this is the payment description

    ]
]);
// get redirect url
$redirectUrl = $chargily->getRedirectUrl();
//like : https://epay.chargily.com.dz/checkout/random_token_here
//
if($redirectUrl){
    //redirect
    header('Location: '.$redirectUrl);
}else{
    echo "We cant redirect to your payment now";
}
  1. create payment processing file process.php
array( "id" => 5566321, "client" => "Client name", "invoice_number" => "123456789", "due_date" => "2022-01-01 00:00:00", "status" => "paid", "amount" => 75, "fee" => 25, "discount" => 0, "comment" => "Payment description", "tos" => 1, "mode" => "EDAHABIA", "invoice_token" => "randoom_token_here", "due_amount" => 10000, "created_at" => "2022-01-01 06:10:38", "updated_at" => "2022-01-01 06:13:00", "back_url" => "https://www.mydomain.com/success", "new" => 1, ); ) */ exit('OK'); } ">
use Chargily\ePay\Chargily;

require 'path-to-vendor/vendor/autoload.php';

$epay_config = require 'epay_config.php';

$chargily = new Chargily([
    //credentials
    'api_key' => $epay_config['key'],
    'api_secret' => $epay_config['secret'],
]);

if ($chargily->checkResponse()) {
    $response = $chargily->getResponseDetails();
    //@ToDo: Validate order status by $response['invoice']['invoice_number']. If it is not already approved, approve it.
    //something else
    /*
        $response like the follwing array
            $response = array(
                "invoice" => array(
                            "id" => 5566321,
                            "client" => "Client name",
                            "invoice_number" => "123456789",
                            "due_date" => "2022-01-01 00:00:00",
                            "status" => "paid",
                            "amount" => 75,
                            "fee" => 25,
                            "discount" => 0,
                            "comment" => "Payment description",
                            "tos" => 1,
                            "mode" => "EDAHABIA",
                            "invoice_token" => "randoom_token_here",
                            "due_amount" => 10000,
                            "created_at" => "2022-01-01 06:10:38",
                            "updated_at" => "2022-01-01 06:13:00",
                            "back_url" => "https://www.mydomain.com/success",
                            "new" => 1,
                );
            )
    */
    exit('OK');
}

Configurations

  • Available Configurations
key description redirect url process url
api_key must be string given by organization required required
api_secret must be string given by organization required required
urls must be array required not required
urls[back_url] must be string and valid url required not required
urls[process_url] must be string and valid url required not required
mode must be in CIB,EDAHABIA required not required
payment[number] must be string or int required not required
payment[client_name] must be string required not required
payment[client_email] must be string and valid email This is where client receive payment receipt after confirmation required not required
payment[amount] must be numeric and greather or equal than 75 required not required
payment[discount] must be numeric and between 0 and 99 (discount in %) required not required
payment[description] must be string required not required
options must be array required not required
options[headers] must be array required not required
options[timeout] must be numeric required not required

Notice

Comments
  • عدم ارسال تحديث الحالة PROCESSING الى webhook

    عدم ارسال تحديث الحالة PROCESSING الى webhook

    السلام عليكم،

    عند ضغط المستخدم على زر Payer وانتقاله الى صفحة الدفع (إما CIB او EDAHABIA)

    payer btn

    لا يتم ارسال معلومات الى Webhook أن العملية أصبحت في حالة PROCESSING.

    في حين انه لو تتحقق داخل لوحة التحكم https://epay.chargily.com/secure/admin/resources/invoice-managers ستجد ان حالة العملية تغيرت من PENDING الى PROCESSING.

    admin trx status

    هل المشكلة من عندي ؟ ام أنها غير موجودة ضمن API ؟

    بارك الله فيكم.

    opened by abdelhakpro 2
  • تحديد اللغة في صفحة الدفع

    تحديد اللغة في صفحة الدفع

    السلام عليكم،

    هل يمكن اضافة خيار تحديد اللغة في صفحة الدفع؟ مثلا في عند كل من CIB أو EDAHABIA تظهر صفحة الدفع بالفرنسية بشكل افتراضي. لكن لو تلاحظ في الرابط يوجد ملف payment_fr.html بنسخة الفرنسية يمكن تعديله الى النسخة العربية payment_ar.html

    cib_fr edahabia_fr

    بعد التعديل الى payment_ar.html تظهر النسخة العربية

    cib_ar edahabia_ar

    هل يمكن اضافة متغير عند انشاء طلب جديد يتم تحديد فيه لغة الواجهة اذا عربية أو فرنسية وهذا لتسهيل عملية الدفع على العملاء.

    بارك الله فيكم.

    opened by abdelhakpro 2
  • Enhancements

    Enhancements

    Hello there, on this PR i added :

    • Support for PHP8 type checking for parameters and for methods return.
    • Support for PSR-1 and PSR-2 .
    • Validator library installed and used to validate configurations rules , instead of traditionally "if else ".
    • New configurations dynamic resolver (based on laravel string helper and __call magic method) (not create a getter for each config).
    • Basic and simple tests added .

    i eddited :

    • Some method are rewritten to be simple .
    • Moved validation of configuration to when initial create Chargily object.
    opened by LAGGOUNE-Walid 2
  • Work on localhost

    Work on localhost

    Hi, i want to know if this package work with local server because i got this error

    Chargily \ ePay \ Exceptions \ InvalidResponseException Invalid response status code (422) when trying to get redirect url . More info ({"message":"The given data was invalid.","errors":{"back_url":["The back url is not a valid URL."],"webhook_url":["The webhook url is not a valid URL."]}})

    Thank you !

    opened by aouniradouan 1
  • Fixed bugs, and added more enhancements

    Fixed bugs, and added more enhancements

    1.Fixed bug :

    1.1. When Chargily object is created for payment, it will validate payment data . and also when is created for webhooks it will be validate with payment rules. So the solution was to separate Payment and Webhooks to diffrent classes.

    2.Implemented single repository pattern . Chargily is splitted into two classes : one for payment and one for webhooks. For payment:

    <?php
    use Chargily\ePay\ChargilyPayer;
    
    require "vendor/autoload.php";
    
    $chargily = new ChargilyPayer([
    // config array
    ]);
    $redirectUrl = $chargily->getRedirectUrl();
    

    For webhooks:

    <?php
    use Chargily\ePay\ChargilyProccessor;
    
    require "vendor/autoload.php";
    
    $chargily = new ChargilyProccessor([
        // ...
    ]);
    
    if ($chargily->checkResponse()) {
        $response = $chargily->getResponseDetails();
    }
    

    3.Added depth resolver to configuration resolver. Now you can do :

    <?php
    $value = $config->from("foobar.barfoo.barbar")->getFoo(); // return Hello world
    // this will return the value inside configuration array ["foobar" => [ "barfoo" => ["barbar" => ["foo" => "Hello world"]] ] ]
    

    4.Added tests for depth resolver. 5.Added validator interface for webhook and redirectUrl validators. 6.Added abstracted class Chargily with global contructor for ChargilyPayment and ChargilyProccessor. 7.Added debug mode to user configuration array. (default is true)

    <?php
    $chargily = new ChargilyProccessor([
        "options" => [
           "headers"   =>  [],
            "timeout"   =>  30,
            "debug"     =>  true
        ],
    ]);
    

    8.Added check when debug mode is true , show exception message . if false quit with http 500.

    opened by LAGGOUNE-Walid 1
Releases(3.0.0)
Owner
Chargily
No. 1 in e-payment services and solutions in Algeria.
Chargily
The Laravel eCommerce Mollie Payment Gateway allows the merchants to integrate Mollie payment gateway to their bagisto Store.

The Laravel eCommerce Mollie Payment Gateway allows the merchants to integrate Mollie payment gateway to their bagisto Store.

Bagisto 2 May 31, 2022
A framework agnostic, multi-gateway payment processing library for PHP 5.6+

Omnipay An easy to use, consistent payment processing library for PHP Omnipay is a payment processing library for PHP. It has been designed based on i

The League of Extraordinary Packages 5.7k Jan 4, 2023
Cardano Mercury Payment Gateway for WooCommerce

Cardano Mercury for WooCommerce Simple, reliable plugin to accept Cardano (Ada) payments for goods and services in WooCommerce. Version: 1.0 Tags: woo

null 25 Aug 3, 2022
Binance Smart Chain - BNB Payment Gateway

BSC Pay (Simple BNB Payment Gateway) I like to use Binance Smart Chain, do you? You can use my simple payment gateway if you need to get paid with BSC

null 18 Dec 19, 2022
Payu payment gateway for bagisto laravel ecommerce open source platform

Bagisto Payu Payment Gateway Payu is a popular payment gateway in india. This package provides a additional strong help for the user to use the payu p

Saju G 3 Dec 14, 2021
QPay Moodle payment gateway plugin

QPay Moodle payment gateway plugin The plugin allows a site to connect to QPay. This plugin was developed by Smotana thanks to funding from Aspire Edu

Matus Faro 2 Dec 31, 2021
Plugin for Woocommerce that enables Visanet's Cybersource payment gateway as a payment method in your website checkout

Plugin for Woocommerce that enables Visanet's Cybersource payment gateway as a payment method in your website checkout

tipi(code) 2 Mar 8, 2022
PHP implementation of Fowler's Money pattern.

Money PHP library to make working with money safer, easier, and fun! "If I had a dime for every time I've seen someone use FLOAT to store currency, I'

Money PHP 4.2k Jan 2, 2023
PHP 7+ Payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc. - provided by Forma-Pro

Supporting Payum Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our

Payum 1.7k Jan 5, 2023
LiteCart - Free Shopping Cart Platform - Built with PHP, jQuery HTML 5 and CSS 3

LiteCart is a lightweight e-commerce platform for online merchants. Developed in PHP, HTML 5, and CSS 3. LiteCart is a registered trademark, property

LiteCart 153 Dec 28, 2022
A free shopping cart system. OpenCart is an open source PHP-based online e-commerce solution.

OpenCart is a free open source ecommerce platform for online merchants. OpenCart provides a professional and reliable foundation from which to build a successful online store.

OpenCart 6.6k Dec 31, 2022
PHP payment library to easily integrate Baltic banklinks (supports old and new iPizza protocol), E-commerce gateaway (Estcard, Nets Estonia), Liisi Payment Link and Pocopay.

PHP Payment library PHP payment library to easily integrate Baltic banklinks, E-commerce gateaway (Estcard, Nets Estonia), Liizi Payment Link and Poco

Rene Korss 34 Apr 27, 2022
Full-featured e-commerce platform with multi-domain and multi-language support for PHP 8

Surikata.io Full-featured e-commerce platform with multi-domain and multi-language support for PHP 8. Free to use for both commercial and personal pro

null 8 Apr 5, 2022
Simple E-Comerce build use Laravel 5.6 require php version 5.6 or 7.4

Simple E-Comerce build use Laravel 5.6 require php version 5.6 or 7.4

Rangga Darmajati 3 Oct 7, 2021
Benefit PHP Shopping Cart Class (Simple Lightweight)

Benefit-PHP-Shopping-Cart-Class Benefit PHP Shopping Cart Class (Simple Lightweight) Table of Contents Initialization Get All Get Item Get Item Child

Osman Cakmak 8 Sep 6, 2022
A PHP package to simplify using DPO Payment API in your application.

DPO (Direct Pay Online) PHP Package The best DPO php package, simple Ever This is the package that will help you add DPO Payment API to your PHP Appli

Zepson Technologies 3 Nov 8, 2022
StrongShop 是一款免费开源的跨境电商商城网站。基于 PHP Laravel6 框架开发,遵循 BSD-3-Clause 开源协议,免费商用。支持多语言,多货币,多种国际配送方式。PayPal 支付,国际信用卡支付。PC Web 端和移动端自适应。

跨境电商独立站的理想选择之一 StrongShop 简介 StrongShop 是一款免费开源的跨境电商商城网站。 StrongShop 是基于 PHP Laravel 框架开发的一款 Web 商城系统。 开发缘起是公司的一套跨境商城系统,原先公司使用的系统是基于 Ecshop 二次开发的,后来因为

OpenStrong 38 Dec 9, 2022
Fausse page de connexion faite en PHP, inclu: blacklist IP, redirection au choix, webhook discord, logs. Pour les informations: IP, mdp, email, géolocalisation, navigateur et bien d'autre

Scam page PayPal v2 1. Tutoriel explicatif [striked] > https://www.youtube.com/watch?v=5_gggGhVZlY [not striked] > https://mega.nz/file/8Idw0BgR#4g3Q0

Esio_dev 20 Nov 13, 2022
Begining of an e-commerce website using PHP and the MVC Pattern

Begining of an e-commerce website using PHP and the MVC Pattern

Ulysse Valdenaire 5 Dec 25, 2022