andrefelipe18/abacatepay-php

There is no license information available for the latest version (1.0.0) of this package.

AbacatePay PHP SDK

1.0.0 2025-02-07 01:32 UTC

This package is auto-updated.

Last update: 2025-05-07 02:07:15 UTC


README

AbacatePay is a PHP library for integrating with the AbacatePay payment gateway.

Installation

Install the library using Composer:

composer require andrefelipe18/abacatepay-php

Usage

Initialize the Library

First, you need to initialize the AbacatePay class with your API token:

require __DIR__ . '/../vendor/autoload.php';

use Andrefelipe18\AbacatePay\AbacatePay;

$abacatePay = new AbacatePay('your_api_token');

Create a Customer

You can create a new customer using the create method:

$customer = $abacatePay->customer()->create(
    new \Andrefelipe18\AbacatePay\Models\Customer(
        'customer@example.com',
        'Customer Name',
        '+1234567890',
        '123456789'
    )
);

List Customers

You can list all customers using the list method:

$customers = $abacatePay->customer()->list();

Create a Billing

To create a new billing, use the create method:

$billing = $abacatePay->billing()->create(
    'ONE_TIME',
    ['PIX'],
    [
        new \Andrefelipe18\AbacatePay\Models\Product(
            'product_1',
            'Product 1',
            'Product 1 description',
            1,
            1000
        ),
        new \Andrefelipe18\AbacatePay\Models\Product(
            'product_2',
            'Product 2',
            'Product 2 description',
            1,
            2000
        ),
    ],
    'https://example.com/return',
    'https://example.com/completion',
    $customer->data->metadata,
);

List Billings

You can list all billings using the list method:

$billings = $abacatePay->billing()->list();

License

Licensed under the MIT license.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.