Laravel Packages

Laravel Cashier for Openpay Billing Services

Published
Laravel Cashier for Openpay Billing Services image

The cashier-openpay package by Pedro Perafán provides an expressive, fluent interface to subscriptions using Openpay billing services with Laravel.

This package is set up by defining an Openpay Billable trait:

use Perafan\CashierOpenpay\Billable;

class User extends Authenticatable
{
    use Billable;
}

Then, you can interact with Openpay billing via a User model instance:

// Create a new customer.
$user->createAsOpenpayCustomer();

// Create a new customer, and send additional data.
$openpay_customer = $user->createAsOpenpayCustomer([
    'name' => 'Teofilo',
    'last_name' => 'Velazco',
    'phone_number' => '4421112233',
    'address' => [
        'line1' => 'Privada Rio No. 12',
        'line2' => 'Co. El Tintero',
        'line3' => '',
        'postal_code' => '76920',
        'state' => 'Querétaro',
        'city' => 'Querétaro.',
        'country_code' => 'MX'
    ],
]);

// Get the Openpay customer record.
$openpay_customer = $user->asOpenpayCustomer();

// Update a customer
$openpay_customer  = $user->asOpenpayCustomer();
$openpay_customer->name = 'Juan';
$openpay_customer->last_name = 'Godinez';
$openpay_customer->save();

Here are some of the highlight features you can do via this package:

  • Create new customers
  • Manage existing customers
  • Delete customers
  • Add a card to a user
  • Get a user's card(s)
  • Create and manage bank accounts for a customer
  • Create and manage charges for a customer
  • Issue refunds on a charge
  • Send/receive transfers
  • Make a payout to a customer and manage customer payouts
  • Add and Manage subscriptions
  • Interact directly with the Openpay PHP SDK

Under the hood, cashier-openpay uses the Openpay PHP bindings package, which is another excellent resource if you want to learn more about using Openpay with PHP.

I'd recommend heading to the usage section of the README to see everything you can do with this package. Also, you can learn more about this package, get full installation instructions, and view the source code on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
Migration Durations and Job Memory Usage in Laravel 13.45 image

Migration Durations and Job Memory Usage in Laravel 13.45

Read article
Laravel CLI: One Binary for New PHP and Rust Laravel Apps image

Laravel CLI: One Binary for New PHP and Rust Laravel Apps

Read article
Phactorial: Render LaTeX Math to SVG and PNG in PHP image

Phactorial: Render LaTeX Math to SVG and PNG in PHP

Read article
Laravel, reimagined image

Laravel, reimagined

Read article
Laravel Rust: A New Rust Web Framework From Laravel image

Laravel Rust: A New Rust Web Framework From Laravel

Read article
Laravel Converse and Agent Kit for Chat Bots and AI Agents image

Laravel Converse and Agent Kit for Chat Bots and AI Agents

Read article