Download the PHP package omidgfx/payir-gateway without Composer
On this page you can find all versions of the php package omidgfx/payir-gateway. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download omidgfx/payir-gateway
More information about omidgfx/payir-gateway
Files in omidgfx/payir-gateway
Package payir-gateway
Short Description Makes your (pay.ir) payments easy and implements reliable interfaces for payment gateway.
License LGPL-2.1-only
Homepage https://github.com/omidgfx/payir-gateway
Informations about the package payir-gateway
Pay.ir gateway for composer
Makes your (pay.ir) payments easy and implements reliable interfaces for payment gateway.
Payir Gateway is a composer library to help working with pay.ir payment gateway.
- Secure
- Reliable
- Easy-to-use
Tutorial
▷ Watch tutorial video in aparat
Basic scenario
For a healthy payment, first of all you need to send the order information to pay.ir and get a token and store it in your database (uniquely), then pass your client to an address that's involved with the token you just got. The client pays and passes back to your website again.
Now the client is in your website, you should verify his payment and sell your stuff.
How to use?
-
Step 1
Add Payir Gateway to your project.
-
Step 2
Create an instance of
Omidgfx\Payir
class using by yourAPI-KEY
. -
Step 3
Get a new
token
from pay.ir bysend
method and use it for opening payment gateway.Use
try-catch
to catch the exceptions. -
Step 4
Check for
$response
to be an instance ofOmidgfx\Payir\SendResponse
class.- if
$response
was an instance ofOmidgfx\Payir\SendResponse
class then save the token in your database and then redirect your client to Pay Link by$response->redirectToPayLink()
or get Pay Link by$response->getPayLink()
as a string. - if
$response
was an instance ofOmidgfx\Payir\ErrorResponse
class then show the error message to your client by$response->error()
or track it down to fix it.
- if
-
Step 5
After payment action performed, the client will be passed to your website, now you need to verify the transaction. Payir Gateway will do this for you with a cool callback listener like following:
Imagine
https://site.com/verify.php?invoice=123
is your callback (redirect), following code must written in your callback listener controller for exampleverify.php
.Do Step 2 in
verify.php
again.Create your callback listener:
Setup events on your callback listener:
- setOnError
- setOnSuccess
- setOnException
Now turn on your callback listener like following:
Created with ❤ by Pejman Chatrrouz (Omidgfx)
🎁 Donate me
All versions of payir-gateway with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *