PHPackages                             payid19/payid19-api-php - 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. [Payment Processing](/categories/payments)
4. /
5. payid19/payid19-api-php

ActiveLibrary[Payment Processing](/categories/payments)

payid19/payid19-api-php
=======================

Payid19 API library for PHP

v1.0.1(2mo ago)33092MITPHPPHP &gt;=7.4

Since Feb 25Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/payid19/payid19-api-php)[ Packagist](https://packagist.org/packages/payid19/payid19-api-php)[ Docs](https://payid19.com)[ RSS](/packages/payid19-payid19-api-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (2)Used By (0)

Payid19 PHP API Library
=======================

[](#payid19-php-api-library)

Accept USDT and cryptocurrency payments on your website using [Payid19](https://payid19.com).

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- ext-curl
- ext-json

Installation
------------

[](#installation)

Install via [Composer](http://getcomposer.org/):

```
composer require payid19/payid19-api-php
```

Getting Started
---------------

[](#getting-started)

1. Create an account at [payid19.com](https://payid19.com)
2. Go to **Settings** and get your **Public Key** and **Private Key**
3. Use the keys to create an instance of the client

```
require_once 'vendor/autoload.php';

$payid19 = new \Payid19\ClientAPI('YOUR_PUBLIC_KEY', 'YOUR_PRIVATE_KEY');
```

Usage
-----

[](#usage)

### Create an Invoice

[](#create-an-invoice)

Creates a new payment invoice and returns a payment page URL.

> Full parameter list: [https://payid19.com/dev/invoices/create\_invoice](https://payid19.com/dev/invoices/create_invoice)

```
$result = $payid19->create_invoice([
    'email'            => 'customer@example.com',
    'price_amount'     => 100,
    'price_currency'   => 'USD',
    'order_id'         => 42,
    'customer_id'      => 7,
    'merchant_id'      => 5,
    'title'            => 'Order #42',
    'description'      => 'Payment for Order #42',
    'add_fee_to_price' => 1,
    'success_url'      => 'https://yoursite.com/payment/success',
    'cancel_url'       => 'https://yoursite.com/payment/cancel',
    'callback_url'     => 'https://yoursite.com/payment/callback',
    'expiration_date'  => 48, // hours
    // 'test'          => 1,  // uncomment to use test mode
]);

$response = json_decode($result);

if ($response->status === 'error') {
    echo 'Error: ' . $response->message[0];
} else {
    // Redirect customer to payment page
    header('Location: ' . $response->message);
}
```

### Get Invoices

[](#get-invoices)

Retrieve existing invoices by order ID.

> Full parameter list: [https://payid19.com/dev/invoices/get\_invoices](https://payid19.com/dev/invoices/get_invoices)

```
$result = $payid19->get_invoices([
    'order_id' => 42,
]);

$response = json_decode($result);
print_r($response);
```

Laravel Integration
-------------------

[](#laravel-integration)

**1. Add your keys to `.env`:**

```
PAYID19_PUBLIC_KEY=your_public_key
PAYID19_PRIVATE_KEY=your_private_key
```

**2. Create a controller:**

```
php artisan make:controller PaymentController
```

```
