Download the PHP package payracash/payra-sdk-php without Composer

On this page you can find all versions of the php package payracash/payra-sdk-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 payra-sdk-php

Payra PHP SDK

Official PHP SDK for integrating Payra's on-chain payment system into your backend applications.

This SDK provides:

How It Works

The typical flow for signing and verifying a Payra transaction:

  1. The frontend prepares all required payment parameters:
    • Network – blockchain name (e.g. Polygon, Linea)
    • Token address – ERC-20 token contract address
    • Order ID – unique order identifier
    • Amount WEI – already converted to the smallest unit (e.g. wei, 10⁶)
    • Timestamp – Unix timestamp of the order
    • Payer wallet address – the wallet address from which the user will make the on-chain payment
  2. The frontend sends these parameters to your backend.
  3. The backend uses this SDK to generate a cryptographic ECDSA signature with its signature key (performed offline).
  4. The backend returns the generated signature to the frontend.
  5. The frontend calls the Payra smart contract (payOrder) with all parameters plus the signature.

This process ensures full compatibility between your backend and Payra’s on-chain verification logic.

Features

Setup

Before installing this package, make sure you have an active Payra account:

https://payra.cash/products/on-chain-payments/registration

Before installing this package, make sure you have a MerchantID

Additionally: To obtain your RPC URLs which are required for reading on-chain order statuses directly from the blockchain, you can use the public free endpoints provided with this package or create an account on one of the following services for better performance and reliability:

Optional (recommended):

Installation

Requirements

Via Composer (recommended)

Or manual installation (for local testing)

Once installed, make sure to include Composer’s autoloader in your project:

Environment Configuration

Create a .env file in your project root (you can copy from example):

This file stores your private configuration and connection settings for all supported networks. Never commit .env to version control.

Required Variables

Exchange Rate (optional)

Used for automatic fiat → USD conversions via the built-in Payra utilities.

Important Notes

Usage Example

Generate Signature

Use PayraUtils::toWei($usdAmount, $network, $tokenSymbol) to easily convert USD to Wei before generating a signature.

Input Parameters

Field Type Description
network string Selected network name
tokenAddress string ERC20 token contract address
orderId string Unique order reference (e.g. ORDER-123)
amountWei string or integer Token amount in smallest unit (e.g. wei)
timestamp number Unix timestamp of signature creation
payerAddress string Payer Wallet Address

Get Order Details

Retrieve full payment details for a specific order from the Payra smart contract. This method returns the complete on-chain payment data associated with the order, including:

Use this method when you need detailed information about the payment or want to display full transaction data.

Example response structure


Check Order Paid Status

Perform a simple payment check for a specific order. This method only verifies whether the order has been paid (true or false) and does not return any additional payment details.

Use this method when you only need a quick boolean confirmation of the payment status.

Example response structure

Note: Network identifiers should always be lowercase (e.g., "polygon", "ethereum", "linea", "flare").

Utilities / Conversion Helpers

The SDK includes helper functions for working with token amounts and currency conversion.

1. Get Token Decimals

Returns the number of decimal places for a given token on a specific network.


2. Convert USD/Token Amounts to Wei


3. Convert Wei to USD/Token

The optional fourth parameter (precision) defines how many decimal places should be returned.
Default is 2, but you can adjust it — for example:


4. Currency Conversion (Optional)

Payra processes all payments in USD. If your store uses another currency (like EUR, AUD, or GBP), you can:

Setup for Currency Conversion

To use the conversion helper, you need a free API key from exchangerate-api.com.

  1. Register a free account and get your API key.
  2. Add the key to your .env file:

  3. That’s it — Payra will automatically fetch the exchange rate and calculate the USD amount.

Note: The free plan allows 1,500 requests per month, which is sufficient for most stores. Exchange rates on this plan are updated every 24 hours, so with caching, it’s more than enough. Paid plans offer faster update intervals.

Security Notice

Never expose your signature key in frontend or client-side code.
This SDK is server-side only and must be used securely on your backend. Never use it in frontend or browser environments. Also, never commit your .env file to version control.

Project

Social Media

License

MIT © Payra


All versions of payra-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
vlucas/phpdotenv Version ^5.6
simplito/elliptic-php Version ^1.0
web3p/web3.php Version ^0.3.2
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 payracash/payra-sdk-php contains the following files

Loading the files please wait ...