Download the PHP package payriff/payriff-php without Composer

On this page you can find all versions of the php package payriff/payriff-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package payriff-php

Payriff PHP SDK

PHP client for the Payriff merchant API: orders, saved-card payments, saved cards, transactions, payouts and invoices.

Installation

Quick start

Requests take associative arrays and responses are returned as associative arrays with the field names of the Payriff API. Create one Payriff instance and reuse it.

Configuration

Argument Required Default Notes
appKey yes — Application key from the Payriff dashboard.
merchantId for payouts and invoices — Merchant ID (e.g. ES1000000).
timeout no 60.0 Total request timeout in seconds. Bank operations can take tens of seconds.
connectTimeout no 10.0 Connection timeout in seconds.
region no Region::AZERBAIJAN API region. Sets the base URL and the default currency.
baseUrl no from region Override the API URL, e.g. for testing. The currency still comes from region.

Keep the app key in an environment variable or secret store. Never commit it.

Saudi Arabia

Region API Default currency
Region::AZERBAIJAN https://api.payriff.com AZN
Region::SAUDI https://api.gccpay.sa SAR

Use the app key from the dashboard of the same region (dashboard.gccpay.sa for Saudi Arabia). A currency passed on a request always wins over the region default.

Orders

paymentStatus is a string such as APPROVED, DECLINED, PREAUTH_APPROVED or REFUNDED.

Amounts can be passed as numeric strings ('10.50'), integers or floats.

Charging a saved card

Saved cards

Transactions

Payouts

Payouts require merchantId on the client.

Invoices

Invoices require merchantId on the client.

Callbacks

When an order changes state, Payriff POSTs JSON to the callbackUrl you set on the order.

Errors

Every SDK exception extends Payriff\Exception\PayriffException, which provides getHttpStatus(), getResultCode() (Payriff result code) and getResponseId() (quote it when contacting support).

Exception When
AuthenticationException App key rejected (14010, 14013, 14014, 14015)
ValidationException Invalid request (15400 or HTTP 400)
RequestRejectedException Business refusal (01000), e.g. application under review
InsufficientBalanceException Not enough wallet balance for a payout (01200)
PayoutLimitException Payout limit reached (01300, 01400, 01500)
ApiException Any other failure reported by Payriff
PayriffConnectionException No response: network error or timeout

Payriff can report a failure with HTTP 200. The SDK checks the result code in the body, so you only need to catch exceptions. Invalid arguments throw InvalidArgumentException before any request is sent.

Retries

The SDK never retries on its own, because payment calls are not safe to repeat blindly. After a PayriffConnectionException, look the operation up first (orders->getByRequestRrn(...), payouts->getByRequestRrn(...)) and retry only if it does not exist. Set requestRrn / idempotencyKey on every request so that this lookup is possible.

Development

License

MIT


All versions of payriff-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package payriff/payriff-php contains the following files

Loading the files please wait ...