PHPackages                             dizpay/dizpay-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dizpay/dizpay-php-sdk

ActiveLibrary[API Development](/categories/api)

dizpay/dizpay-php-sdk
=====================

The official PHP library for the DizPay API 2.0

0312[2 PRs](https://github.com/dizpay/dizpay-php-sdk/pulls)PHP

Since Aug 27Pushed 6y ago3 watchersCompare

[ Source](https://github.com/dizpay/dizpay-php-sdk)[ Packagist](https://packagist.org/packages/dizpay/dizpay-php-sdk)[ RSS](/packages/dizpay-dizpay-php-sdk/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

DizPay PHP SDK
==============

[](#dizpay-php-sdk)

The open source PHP SDK that allows you to access the [DizPay](https://www.dizpay.com/) API from your PHP app.

Table of Contents
=================

[](#table-of-contents)

- [Introduction](#Introduction)
- [Prerequisites](#Prerequisites)
- [Installation](#Installation)
- [Usage](#Usage)
    - [Checkout method](#Checkout)
    - [API method](#API)
    - [Sample code](#Sample-code)
    - [Response codes](#Response-codes)
- [Additional Reference](#Reference)

Introduction
============

[](#introduction)

DizPay APIs let you integrate BTC, ETH, LTC, DASH, USDT, GUSD, PAX, TUSD and USDC payments into your online application. Using the DizPay PHP SDK, you can integrate DizPay into multiple PHP frameworks such as [Laravel](https://laravel.com/), [Lumen](https://lumen.laravel.com/) and [ThinkPHP](http://www.thinkphp.cn/).

Before you start using DizPay, make sure that you obtain your **App ID** and your **App Key** from [DizPay](https://www.dizpay.com) by signing up to the website.

The DizPay SDK APIs are grouped into:

- Assets API
- Checkout API
- Orders API
- Rates API

You can use these to send requests and get responses from DizPay. Refer to the [API Reference](https://www.dizpay.com/en/docs) manual for details on the request and response details for each of them.

Prerequisites
=============

[](#prerequisites)

PHP 5.6 or above

Installation
============

[](#installation)

Install using `composer`:

`composer require dizpay/dizpay-php-sdk:dev-master`

Usage
=====

[](#usage)

Use the following lines of code in your PHP file to set up DizPay:

```
require_once __DIR__.'/../vendor/autoload.php';
$profile = new \DizPay\DizPayProfile('YOUR_APP_ID', 'YOUR_APP_KEY');
```

Once you complete the setup, you can use the `profile` variable created above to send requests to the DizPay APIs.

There are two ways to use the DizPay SDK: `checkout` and `API`.

- `checkout` is the default integration method, where you can use the DizPay UI.
- `API` is the native method, where you need to implement your own UI.

### Checkout

[](#checkout)

To use `checkout`, call the `checkout::invoice` method. It returns a pay URL address. Simply add the provided URL to your webpage where it is accessible for all your users.

When the user finishes the payment, DizPay notifies you with the corresponding result via both the sync (via `success_url`) and async (via `notify_url`) notifications.

- Sync notification: It does not take any arguments, you should always treat it as success when it reaches.
- Async notification: DizPay sends you a `POST` notification payStatus/amount/orderNo to the address set in the `notify_url` key while creating the API.

### API

[](#api)

Using this method, you need to implement your own cashier procedure with DizPay [API Reference](https://www.dizpay.com/en/docs).

There are two ways to create an API instance.

- By Factory

```
$profile =  new \DizPay\DizPayProfile('YOUR_APP_ID', 'YOUR_APP_KEY');

$assets = \DizPay\DizPayAPIFactory::assets($profile);
$checkout = \DizPay\DizPayAPIFactory::checkout($profile);
$orders = \DizPay\DizPayAPIFactory::orders($profile);
$rates = \DizPay\DizPayAPIFactory::rates($profile);
```

- By `new` operator

```
$profile =  new \DizPay\DizPayProfile('YOUR_APP_ID', 'YOUR_APP_KEY');

$assets = new \DizPay\Api\Assets($profile);
$checkout = new \DizPay\Api\Checkout($profile);
$orders = new \DizPay\Api\Orders($profile);
$rates = new \DizPay\Api\Rates($profile);
```

An API contains two properties:

- `baseUri`
- `prefix`

Each API call is then sent to DizPay as: `baseUri + prefix + endPoint`, the `endPoint` is resolved by the method name.

The PHP magic method `__call` then converts the method name (SDK API name, which is camelcase ) to snakecase and uses it as the actual request endpoint.

For example. `$order->createChargeOrder(...)` is converted to `create_charge_order`.

So, the final request is sent as:

```
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d   https://api.dizpay.com/v2/member/orders/create_charge_order
```

Source Code:

```
    // Source Code at src/DizPay/Common/BaseAPI.php

    public function __call($name, $arguments)
    {
        $endPoint = strtolower(preg_replace('/(?', '_$0', $name));

        $payloads = $this->preparedPayload($arguments ? $arguments[0] : []);

        $this->response = $this->httpClient->post($this->prefix . '/' . $endPoint,
            [
                'json' => $payloads,
            ]);

        return $this;
    }
```

### Sample code

[](#sample-code)

The following lines of code show you how to get a sample invoice using the `profile` variable created during setup:

```
$checkout = \DizPay\DizPayAPIFactory::checkout($profile);
$invoice = $checkout->invoice(
    [
        'order_number' => uniqid('TEST_ORDER:'), # required
        'name' => 'DizPay Inc.', // 'Your Merchant Name, eg: DizPay Inc.',
        'description' => 'Add crypto to your account.', // 'optional, default is: Add crypto to your {{ Domain or App Name }} account.',
        'logo_url'=> 'https://cdn.shopifycloud.com/hatchful-web/assets/c3a241ae6d1e03513dfed6f5061f4a4b.png',
        'payer_info' => 'email', // one of in ['', 'email', 'mobile']
        'pricing_type' => 'fixed_price', // one of in ['fixed_price', 'no_price'],
        'currency' => 'USD', // required, split by commas, valid option is USD | CNY | GBP | BTC | ETH | LTC | DASH | USDT | TUSD | GUSD | PAX | USDC
        'amount' => '100',    // string, required
        'rate' => 'huobi', // optional, default is coinmarketcap, one of in ['coinmarketcap', 'okex', 'binance', 'huobi']
        'crypto' => 'USDC,TUSD,PAX,GUSD,USDT,ETH,BTC,LTC,DASH', // required, split by commas, valid option is BTC | ETH | LTC | DASH | USDT | TUSD | GUSD | PAX | USDC
        'locale' => 'auto', // language, one of in ['auto', 'en', 'cn', 'ru', 'ko', 'jp']
        'success_url' => 'https://example.com/diz-pay-result?type=success', // optional, redirect to the merchant URL after successful payment.
        'cancel_url' => 'https://example.com/diz-pay-result?type=failed', // optional, edirect to a failure URL when the charge failed to complete. The buyer cancels the order or the payment expired.
        'notify_url' => 'https://demo.dizpay.com/webhook',                // optional, Send information to the callback URL when charge has been confirmed and the associated payment is completed.
        'extra' => 'another-params',
    ]
);

echo 'Checkout API Call Result:' . ($invoice->isSuccessful() ?  'Successful' : 'Failed') .PHP_EOL . 'Response:' . $invoice;
```

To get you started, you can check out other [samples](./sample) API calls.

### Response codes

[](#response-codes)

Once you send requests, the DizPay APIs send you a code in the response. The most commonly returned response codes are:

Responce CodeErrorDescription200OKRequest succeeded400BadRequest request failed401UnauthorizedApp ID is invalid or blocked403ForbiddenSigning failure500Internal Server ErrorInternal server error occurredDizPay API returns the following error codes in response if the response code is `400`:

Error CodeDescription1000Field Syntax Error (e.g. Required, Range, Type)1001Something does not exist1002Something does not match1003Something is invalid1004Failed to send sms1005Request too frequently1006Something is expired1008Balance is not enough1010Failed to send email1051Wallet Server went wrongReference
=========

[](#reference)

- [API Reference](https://www.dizpay.com/en/docs)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40382760?v=4)[dizpay](/maintainers/dizpay)[@dizpay](https://github.com/dizpay)

---

Top Contributors

[![shellvon](https://avatars.githubusercontent.com/u/3349696?v=4)](https://github.com/shellvon "shellvon (10 commits)")

### Embed Badge

![Health badge](/badges/dizpay-dizpay-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/dizpay-dizpay-php-sdk/health.svg)](https://phpackages.com/packages/dizpay-dizpay-php-sdk)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
