mahan-shoghy / laravel-squareup
Squareup implementation for Laravel
Requires
This package is auto-updated.
Last update: 2025-03-08 10:38:19 UTC
README
Laravel Squareup API Package enables secure payment processing and easy integration with Square's suite of business solutions. Simplify order management, inventory synchronization, and customer record-keeping, ensuring seamless interaction with Square sellers' systems. Easily build dynamic business applications with Square's RESTful API design.
Table of Contents
Installation
Via composer (Laravel 10+):
composer require mahan-shoghy/laravel-squareup
Publish the config file, use the following command:
php artisan vendor:publish --provider="MahanShoghy\LaravelSquareup\SquareupServiceProvider" --tag="config"
Usage
Setup .env file
Add and set these variables to your environment file:
SQUAREUP_APPLICATION_ID=
SQUAREUP_APPLICATION_SECRET=
SQUAREUP_ACCESS_TOKEN=
You can obtain these values from the Squareup App Setting.
If you wish to use the sandbox, set
SQUAREUP_HOST
to
https://connect.squareupsandbox.com
in your environment file.
API
Explore the various API endpoints provided by the Squareup API, organized into the following categories:
- Essentials
- Commerce
- Merchants
Each section provides detailed instructions on how to interact with the Squareup API for different aspects of your business.
Webhook
Webhooks allow your Laravel application to receive and handle Squareup events in real-time. Follow these steps to set up webhook handling in your application.
- Define a Webhook Route: In your Laravel routes file (like: web.php), add a route for handling webhooks. You can choose any URL you prefer:
Route::squareupWebhooks('your-webhook-url');
Configure Webhook Events: Open the
squareup.php
configuration file (which you published in Installation) and specify the events you want to handle and the corresponding job classes. Here's an example:'jobs' => [ 'bank_account_created' => BankAccountCreatedJob::class ]
In the job class, you can access the payload data sent by Squareup to handle the event.
class BankAccountCreatedJob implements ShouldQueue { public array $payload; public function __construct(array $payload) { $this->payload = $payload; } public function handle(): void { // Handle the webhook event using $this->payload } }
Event Documentation: You can find a list of available Squareup webhook events in the Squareup documentation. This resource will help you understand and configure the events you wish to handle.
Use Laravel Queues: For better performance and scalability, consider using Laravel queues to handle webhook jobs asynchronously. This ensures that your application remains responsive even during heavy webhook traffic.
Now, your Laravel application is ready to receive and process Squareup webhook events in real-time.
Support
If you have any questions or need assistance, feel free to contact us. if there are specific code examples you'd like to include in the README to help users get started quickly, you can add those as well.
Donate
If you find this package helpful and would like to support its development, you can make a donation in cryptocurrency. Your contributions will help maintain and improve this package.
You can send your contribution to the following address in your MetaMask wallet:
Wallet Address:
0x4B3d57AC72B57a76b778Bac4e3b32d2d4d729955
Thank you for your support!