PHPackages                             perafan/cashier-openpay - 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. perafan/cashier-openpay

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

perafan/cashier-openpay
=======================

Laravel Cashier provides an expressive, fluent interface to Openpay's subscription billing services.

2.0.0(5y ago)14742MITPHP

Since Oct 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Perafan18/cashier-openpay)[ Packagist](https://packagist.org/packages/perafan/cashier-openpay)[ Docs](https://github.com/Perafan18/cashier-openpay)[ RSS](/packages/perafan-cashier-openpay/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (6)Used By (0)

CashierOpenpay
==============

[](#cashieropenpay)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f0f1240e8dbd7409e1ad8c52cba97119e072e058710845d252b715d3babca754/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7065726166616e2f636173686965722d6f70656e7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/perafan/cashier-openpay)[![Total Downloads](https://camo.githubusercontent.com/f39c2e8a018ccd3322d164f6a3256824b2bbc2dbc2cda9346b3f69020a934627/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7065726166616e2f636173686965722d6f70656e7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/perafan/cashier-openpay)[![Build Status](https://camo.githubusercontent.com/3674094ff1094c8729d801b651d9d53d05fabd7c15d51a0d61640d6f71fb4f4b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5065726166616e31382f636173686965722d6f70656e7061792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/github/Perafan18/cashier-openpay)[![StyleCI](https://camo.githubusercontent.com/2984e35187ab88e95b4be8eba45cac1bd4c03eb01b8c724ecdea2cf57251efb1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133333230313434302f736869656c643f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/2984e35187ab88e95b4be8eba45cac1bd4c03eb01b8c724ecdea2cf57251efb1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133333230313434302f736869656c643f6272616e63683d6d6173746572)

[![Banner](https://camo.githubusercontent.com/3b282422f47a095d649552924399ba8b6b31ab253e6c0523734c52972b5b6067/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f436173686965722532304f70656e5061792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7065726166616e253246636173686965722d6f70656e706179267061747465726e3d656e646c657373436c6f756473267374796c653d7374796c655f31266465736372697074696f6e3d5468652b73616d652b636173686965722b796f752b616c72656164792b6b6e6f772b6275742b776974682b4f70656e7061792b266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d63617368)](https://camo.githubusercontent.com/3b282422f47a095d649552924399ba8b6b31ab253e6c0523734c52972b5b6067/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f436173686965722532304f70656e5061792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7065726166616e253246636173686965722d6f70656e706179267061747465726e3d656e646c657373436c6f756473267374796c653d7374796c655f31266465736372697074696f6e3d5468652b73616d652b636173686965722b796f752b616c72656164792b6b6e6f772b6275742b776974682b4f70656e7061792b266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d63617368)

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

[](#installation)

Require the Cashier package for Openpay with Composer:

```
composer require perafan/cashier-openpay
```

CashierOpenpayLaravel1.X7.X2.X8.XRun to publish migrations, WebHookController and config file.

```
php artisan vendor:publish --tag="cashier-openpay-migrations"
php artisan vendor:publish --tag="cashier-openpay-configs"
php artisan vendor:publish --tag="cashier-openpay-webhook-controller"
```

The Cashier service provider registers its own database migration directory, so remember to migrate your database after installing the package. The Cashier migrations will add several columns to your users table as well as create a new subscriptions table to hold all of your customer's subscriptions:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

### Billable Model

[](#billable-model)

Add the `Billable` trait to your model definition. `Billable` trait provides methods to allow yo to perform common billing tasks (creating subscriptions, add payment method information, creating charges ,etc.)

```
use Perafan\CashierOpenpay\Billable;

class User extends Authenticatable
{
    use Billable;
}
```

Cashier assumes your Billable model will be the `App\Models\User class that ships with Laravel. If you wish to change this you can specify a different model in your `.env` file:

```
OPENPAY_MODEL=App\Models\User
```

### API Keys

[](#api-keys)

Next, you should configure your Openpay keys in your .env file. You can retrieve your Openpay API keys from the Openpay control panel.

```
OPENPAY_PUBLIC_KEY=-your-openpay-public-key-
OPENPAY_PRIVATE_KEY=-your-openpay-private-key-
OPENPAY_ID=-your-openpay-id-
```

### Environment

[](#environment)

By convenience and security, the sandbox mode is activated by default in the client library. This allows you to test your own code when implementing Openpay, before charging any credit card in production environment.

```
OPENPAY_PRODUCTION_MODE=false
```

### Logging

[](#logging)

Cashier allows you to specify the log channel to be used when logging all Openpay related exceptions.

```
OPENPAY_LOG_ERRORS=true
```

### Show openpay errors (Optional)`

[](#show-openpay-errors-optional)

If you want to catch all the openpay exceptions add in your `app/Exceptions/Handler.php`

```
