danielmlozano/laravel-conekta

Laravel package that provides a simple, easy-to-use interface to Conekta Payment services

v1.1.1 2022-11-04 17:05 UTC

This package is auto-updated.

Last update: 2024-11-04 21:35:56 UTC


README

Laravel package that provides a simple, easy-to-use interface to Conekta Payment services.

Installation

  1. First of all, require the Package via Composer
$ composer require danielmlozano/laravel-conekta
  1. Publish the configuration file
$ php artisan vendor:publish --tag="conekta-config"
  1. If necessary, publish the migrations as well
$ php artisan vendor:publish --tag="conekta-migrations"
  1. Add your Conekta public and secret key to your .env file and your currency in ISO format
CONEKTA_KEY=key_your_conekta_public_key
CONEKTA_SECRET=key_your_conekta_private_key
CONEKTA_CURRENCY=usd
  1. If you're using a custom User Model, add it to your .env as well
CONEKTA_USER_MODEL="App\Models\CustomModel"
  1. Add the Purchaser trait to your User model
use Danielmlozano\LaravelConekta\Purchaser;

class User extends Authenticatable implements MustVerifyEmail
{
    use Notifiable, HasFactory, Purchaser;
  1. Now, you can access to the API.
$user = User::first();
// Create a new Conekta Customer
$user->createAsConektaCustomer();

//Add a payment method
$user->addPaymentMethod('payment_method_token', 'card');

Documentation

You can read the entire documentation here: https://danielmlozano.dev/docs/laravelconekta/

Contributors

I created this package for a project and in its first version, only contain the functionality that I needed. For this reason. all contributors are welcome to improve and add more features to the package.