Skip to content

Commit

Permalink
README updated;
Browse files Browse the repository at this point in the history
  • Loading branch information
hans-thomas committed Sep 23, 2023
1 parent 2016deb commit 401d911
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 1 deletion.
104 changes: 103 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,109 @@
![StyleCi](https://github.styleci.io/repos/681052866/shield?style=plastic)

Lyra is a payment gateway that supports offline purchase as well. There are two defined gateway by default, but you can
implement your owns.
implement your own gateway(s).

## Installation

Via composer

```bash
composer require hans-thomas/lyra
```

Then publish the config file

```bash
php artisan vendor:publish --tag lyra-config
```

## Usage

Lyra supports online and offline modes. First we are going to introduce the online mode.

### Online purchase

#### Pay

To pay a purchase, you can simply call `pay` method and pass the amount.

```php
Lyra::pay(10000);
```

#### getRedirectUrl

After calling `pay` method, you can call `getRedirectUrl` method to get the gateway url as string.

```php
Lyra::pay(10000)->getRedirectUrl();
```

#### redirect

Also, you can call `redirect` method to redirect the user to the gateway url after calling the `pay` method.

```php
Lyra::pay(10000)->redirect();
```

#### setGateway

You can set another gateway **before calling the `pay` method** and override the default one.

```php
Lyra::setGateway(Payir::class, 10000)->pay();
```

#### verify

To verify the purchase, on callback, you can call `verify` method and pass the amount of payment.

```php
Lyra::verify(10000);
```

#### getInvoice

After calling `pay` method, you can get the created invoice using `getInvoice` method.

```php
Lyra::pay(10000)->getInvoice();
```

### Offline purchase

#### pay

To purchase an offline payment, you must call `offline` method first and then `pay` method.

```php
Lyra::offline()->pay($file, $amount = 10000);
```

#### getInvoice

Also, in offline mode, you can call `getInvoice` method to get the created invoice after the `pay` method.

```php
Lyra::offline()->pay($file, 10000)->getInvoice();
```

#### accept

To accept an offline purchase, call `accept` method and pass the related invoice.

```php
Lyra::offline()->accept($invoice);
```

#### deny

To deny a purchase, call `deny` method.

```php
Lyra::offline()->deny($invoice);
```

## Contributing

Expand Down
1 change: 1 addition & 0 deletions src/Facades/Lyra.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @method static Invoice getInvoice()
*
* @see LyraService
* @see LyraOfflineService
*/
class Lyra extends Facade
{
Expand Down

0 comments on commit 401d911

Please sign in to comment.