matheusfs / laravel-checkout
Add complete shopping functionalities to your application
Installs: 11 367
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
Requires
- flyingluscas/correios-php: ^2.4
- pagarme/pagarme-php: ^4.0.4
Requires (Dev)
- phpunit/phpunit: ^8.0
- dev-master
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.1-alpha.18.9
- 0.3.1-alpha.18.8
- 0.3.1-alpha.18.7
- 0.3.1-alpha.18.6
- 0.3.1-alpha.18.5
- 0.3.1-alpha.18.4
- 0.3.1-alpha.18.3
- 0.3.1-alpha.18.2
- 0.3.1-alpha.18.1
- 0.3.1-alpha.18
- 0.3.1-alpha.17
- 0.3.1-alpha.16
- 0.3.1-alpha.15
- 0.3.1-alpha.14
- 0.3.1-alpha.13
- 0.3.1-alpha.12
- 0.3.1-alpha.11
- 0.3.1-alpha.10
- 0.3.1-alpha.9
- 0.3.1-alpha.8
- 0.3.1-alpha.7
- 0.3.1-alpha.6
- 0.3.1-alpha.5
- 0.3.1-alpha.4
- 0.3.1-alpha.3
- 0.3.1-alpha.2
- 0.3.1-alpha.1
- 0.3.1-alpha
- dev-dependabot/composer/guzzlehttp/guzzle-7.7.x-dev
This package is auto-updated.
Last update: 2025-03-07 23:56:23 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)); }