The library provides convenient access to the Epoint.az API from applications written in the PHP language.

Overview

Tural/Epoint library/SDK

The library provides convenient access to the Epoint.az API from applications written in the PHP language. It includes a pre-defined set of static class functions for API resources that initialize themselves dynamically from Tural/Epoint class which makes it easier without writing repetitive configuration.

Requirements

PHP 7 and later

Installation

composer require tural/epoint

To include use Composer's autoload:

require_once('vendor/autoload.php');

Dependencies

Guzzle

Getting started

Payment by typing card number

$response = Epoint::typeCard(PRIVATE_KEY, PUBLIC_KEY, "your_order_id", '0.01', 'Test payment');

if ($response->status == 'success') {

    // if successful it redirects to bank's payment page,
    // when user pays successfully, epoint will call the success webhook you provided
    $this->flashSuccess()->redirect($response->redirect_url);
    
} else {

    // handle failure
    
}

Cancel payment

$response = Epoint::cancel("write epoint transaction id");

if ($response->status == 'success') {

    // handle success
    
} else {

    // handle failure
    
}

Check payment

// if false, it will check by order_id, if true,
// it will check by epoint transaction id
$epoint_transaction = false;

$response = Epoint::checkPayment("order or transaction id", $epoint_transaction);

// handle response
dd($response);

Save card for payment

$response = Epoint::saveCardForPayment("Kartı yadda saxla");

if ($response->status == 'success') {

    // save it to db
    $card_uid=$response->card_id;

    $this->flashSuccess()->redirect($response->redirect_url);
    
} else {

    // handle failure
    
}

Save card for refund

$response = Epoint::saveCardForRefund("Kartı yadda saxla");

if ($response->status == 'success') {

    // save it to db
    $card_uid = $response->card_id;
    $this->flashSuccess()->redirect($response->redirect_url);
    
} else {

    // handle failure
    
}

Pay with saved card

// if successful it returns success
$response = Epoint::payWithSaved("card_uid", 'order_id', 'amount for ex. 0.01', 'write description');

if ($response->status == 'success') {

    $epoint_transaction = $response->transaction;
    $bank_transaction = $response->bank_transaction;
    
} else {

    // handle failure
    
}

Refund action

$response = Epoint::refund("card_uid", 'order_id', 'amount 0.05', 'write description');

if ($response->status == 'success') {

    // handle success
    $this->redirect($response->redirect_url, true);
    
} else {

    // handle failure
    
}

Webhook called by Epoint on success or failure

$data = $this->req('data');

if (!empty($data)) {

    $epoint = new Epoint([
        "data" => $_POST["data"], 
        "signature" => $_POST["signature"]
    ]);

    // verify the response is really coming from epoint
    if ($epoint->isSignatureValid()) {

        $json_string = $epoint->getDataAsJson();
        $json = $epoint->getDataAsObject();

        // handle them for your needs
        $json->order_id ?? null,
        $json->status ?? null, 
        $json->code ?? null, 
        $json->transaction ?? null, 
        $json->bank_transaction ?? null, 
        $json->card_id ?? null, 
        $json->card_name ?? null, 
        $json->card_mask ?? null, 
        $json->operation_code ?? null, 
        
        // json as string
        $json_string ?? null;

        // if payment is successful
        if ($json->status == 'success') {

            // if card_id is set it means it is save_card response
            if (!empty($json->card_id)) {

                // handle

            }
        }

    }
}

All the parameters of the class are inline-documented inside class.

You can have a look at Api documentation in Azerbaijani, English and Russian.

You might also like...
Lightweight PHP library for WhatsApp API to send the whatsapp messages in PHP provided by ultramsg.com

Ultramsg.com WhatsApp API PHP SDK Lightweight PHP library for WhatsApp API to send the whatsappp messages in PHP provided by Ultramsg.com Installation

Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

BeckhoffPLCSoapClient - SoapClient to communicate with BeckHoff PLC. Library made in PHP based on TcAdsWebService JavaScript Library.

BeckhoffPLCSoapClient - SoapClient to communicate with BeckHoff PLC. Library made in PHP based on TcAdsWebService JavaScript Library.

PHP library for the Stripe API.

Stripe PHP bindings The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a p

A PHP library for communicating with the Twilio REST API and generating TwiML.

twilio-php The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio API c

A PHP library for the Campaign Monitor API

createsend A PHP library which implements the complete functionality of the Campaign Monitor API. Installation Composer If you use Composer, you can r

PHP 5.3+ library which helps you to interact with the DigitalOcean API

DigitalOcean The version 2 of the API will be available soon ! Please visit DigitalOceanV2 and contribute :) This PHP 5.3+ library helps you to intera

PHP library for the GitHub API v3

GitHub API v3 - PHP Library Currently under construction. Overview Provides access to GitHub API v3 via an Object Oriented PHP library. The goal of th

PHP library to use IOTA REST API to help node management and tangle queries

iota.php About PHP library to use IOTA REST API to help node management and tangle queries. Please be aware that this library is in an early developme

Releases(v1.0.0)
Owner
Tural
Programmer
Tural
Wise-php - This library is written to accommodate the wise API's use in php projects With Wise

Wise-php - This library is written to accommodate the wise API's use in php projects With Wise you can automate payments, connect your business tools, and create ways to manage your finances. You can also power your cross-border and domestic payouts.

Albert Xhani 15 Nov 17, 2022
A library written in PHP to interact with Coinbase Pro via API.

A library written in PHP to interact with Coinbase Pro via API.

Blake Hamilton 4 Mar 31, 2022
PHP package providing easy and fast access to Twitter API V2.

Twitter API V2 is a PHP package that provides an easy and fast access to Twitter REST API for Version 2 endpoints.

Julien SCHMITT 38 Dec 12, 2022
Access your Slack Team's API through PHP objects.

Slack API library Access your Slack Team's API through PHP objects. Documentation Getting started - Before you use this library, you need to generate

Cas 77 Oct 7, 2021
A bot that translates the words you choose during the chat in Telegram to the language you want.

About Needy Telegram Translator If you are constantly using telegram and want to translate words into different languages, this library is for you. Qu

İbrahim Sayar 2 May 27, 2022
OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Mounir R'Quiba 6 Jun 14, 2023
A telegram bot to check credit cards. written in php & py

MRBANKER BOT A telegram bot to check credit cards. written in php & py. You can find me on telegram STEP1: goto botfather create a bot copy the token

Nitin1818 48 Dec 30, 2022
An asynchronous ClamAV wrapper written in PHP with amphp/socket

amphp-clamav An asynchronous ClamAV wrapper written with amphp/socket Installing composer require pato05/amphp-clamav Examples Ping and scan of a fil

Pato05 4 Feb 28, 2022
OpenDialog is a Conversational Experience Platform - the starting point for your own conversational applications.

OpenDialog - open-source conversational application platform OpenDialog enables you to quickly design, develop and deploy conversational applications.

OpenDialog 252 Dec 28, 2022