matheusfs / laravel-checkout
Add complete shopping functionalities to your application
Package info
github.com/continuo-tecnologia/laravel-checkout
pkg:composer/matheusfs/laravel-checkout
0.3.3
2021-03-05 23:08 UTC
Requires
- flyingluscas/correios-php: ^2.4
- pagarme/pagarme-php: ^4.0.4
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2026-06-18 19:23:03 UTC
README
Laravel checkout facade to Pagar.me v4 api
Test coverage map
Instalation
composer require matheusfs/laravel-checkout
php artisan vendor:publish --provider="MatheusFS\Laravel\Checkout\CheckoutServiceProvider" --tag="config"
Simple payment link redirect
public function buy(Request $request, $id) { # Request creates objects from inputs name $shipping = (object) $request->shipping; $customer = (object) $request->customer; $item = Product::find($id); # your product model goes here # Normalize address w/ Pagar.me v4 API $address = new Address( $shipping->street, $shipping->street_number, $shipping->zipcode, 'br', # Default country, if you operate w/ more than one country you can modify the request to ask user $shipping->state, $shipping->city, $shipping->neighborhood, $shipping->complementary ); # Normalize shipping w/ Pagar.me v4 API $Shipping = new Shipping($shipping->name, $address, $shipping->fee, new DateTime()); # Initiate facade $pagarme = new Checkout(); # Normalize customer and billing w/ Pagar.me v4 API $pagarme->setCustomer($customer->name, $customer->cpf, $customer->phone_number, $customer->email); $pagarme->setBilling('Entrega', $address); $pagarme->setShipping($Shipping); # Add normalized item to checkout $pagarme->addItem($item->id, $item->label, $item->price); # Redirect the user to the generated payment link return redirect($pagarme->getPaymentLink($item->price + $shipping->fee)); }