承接 yoco/yoco-php-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yoco/yoco-php-laravel

最新稳定版本:v0.1.0-beta

Composer 安装命令:

composer require yoco/yoco-php-laravel

包简介

Yoco PHP Library for Laravel

README 文档

README

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:

  1. Securely capture card details using the Web SDK, which then provides a charge token
  2. Send the charge token to your Laravel backend application and finalise the charge via the ChargeController deployed by this library

A 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.

Requirements

  • PHP 7.0 and later
  • Laravel 7+

Installation

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.

Setup your keys

Edit the file /config/yoco.php and set the secret and public keys you received from the Yoco Business Portal.

Making a purchase

A simple example is as follows:

  • The frontend Web SDK has been used to capture the card details, amount and currency as described in the SDK docs.
  • The frontend makes an AJAX request to your charge route /yoco/charge, which is processed by your ChargeController.
  • The result will be returned to your frontend as JSON.

Yoco API Documentation

See the API docs.

统计信息

  • 总下载量: 6.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: mit
  • 更新时间: 2021-08-06