Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

ZarinPal driver for the Omnipay PHP payment processing library

License

NotificationsYou must be signed in to change notification settings

nekofar/omnipay-zarinpal

Repository files navigation

ZarinPal driver for the Omnipay PHP payment processing library

Packagist VersionPHP from PackagistPackagist DownloadsTests StatusCoverage StatusLicenseTwitter: nekofar

Omnipay is a framework agnostic, multi-gateway paymentprocessing library for PHP. This package implements ZarinPal support for Omnipay.

Installation

Omnipay is installed viaComposer. To install, simply requireleague/omnipay andnekofar/omnipay-zarinpal with Composer:

composer require league/omnipay nekofar/omnipay-zarinpal

Basic Usage

The following gateways are provided by this package:

  • ZarinPal

For general usage instructions, please see the mainOmnipayrepository.

Example

Purchase

The result will be a redirect to the gateway or bank.

useOmnipay\Omnipay;$gateway = Omnipay::create('ZarinPal');$gateway->setMerchantId('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');$gateway->setReturnUrl('https://www.example.com/return');// Send purchase request$response =$gateway->purchase(['amount' =>100,'description' =>'Some description'])->send();// Process responseif ($response->isRedirect()) {// Redirect to offsite payment gateway$response->redirect();}else {// Payment failed: display message to customerecho$response->getMessage();}

On return, the usual completePurchase will provide the result of the transaction attempt.

The final result includes the following methods to inspect additional details:

// Send purchase complete request$response =$gateway->completePurchase(['amount' =>100,'authority' =>$_REQUEST['Authority'], )->send();// Process responseif ($response->isSuccessful()) {// Payment was successfulprint_r($response);}else {// Payment failed: display message to customerecho$response->getMessage();}

Testing

composertest

Support

If you are having general issues with Omnipay, we suggest posting onStack Overflow. Be sure to add theomnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project,or ask more detailed questions, there is also amailing list whichyou can subscribe to.

If you believe you have found a bug, please report it using theGitHub issue tracker,or better yet, fork the library and submit a pull request.


[8]ページ先頭

©2009-2025 Movatter.jp