Downloads
Stars
Version
This Laravel package is a Laravel-friendly library which wraps the Yoco PHP client library to provide access to the Yoco Online Payments API from PHP. It does this by providing a ChargeController and associated routes that can be called from the JavaScript frontend.
This library is used in conjunction with the frontend Web SDK described here which securely captures the customer's card details and generates the required token.
Put simply, the process is:
ChargeController
deployed by this libraryA full sample implementation of the Web SDK in vanilla PHP and Laravel is available here.
For more information on the APIs, you can refer to the Yoco API Docs.
Install the library into your Laravel application with Composer and publish core files:
# Composer install
composer require yoco/yoco-php-laravel
# Publish config and charge controller
php artisan vendor:publish --tag=yoco
The above installation will add the files /config/yoco.php
and /app/Http/Controllers/ChargeController.php
to your source tree and also add the route /yoco/charge
to your route list.
Edit the file /config/yoco.php
and set the secret and public keys you received from the Yoco Business Portal.
A simple example is as follows:
/yoco/charge
, which is processed by your ChargeController
.See the API docs.