yorki/laravel-payu 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

yorki/laravel-payu

Composer 安装命令:

composer require yorki/laravel-payu

包简介

PayU client for Laravel

README 文档

README

Laravel implementation of REST API for PayU service

composer require yorki/laravel-payu

To publish config

php artian vendor:publish --provider="Yorki\Payu\ServiceProvider"

Example of implementation in our controller

<?php
//$client is instance of Client
$orderRequest = $client->getNewOrderRequest();
$orderRequest->setCurrencyCode(NewOrder::CURRENCY_PLN)
    ->setExtOrderId(123456)
    ->setTotalAmount(10000)
    ->setDescription('Premium')
    ->setCustomerIp($request->getClientIp());

//Lets get instance of NewOrder request and fill it up
$product = $orderRequest->getProducts()->create();
$product->setName('Konto premium')
    ->setQuantity(1)
    ->setUnitPrice(10000);

//Send our request and get response object
$response = $orderRequest->send();

//Check if we are fine
if ($response->isSuccess()) {
    //We should redirect to payment gateway
    redirect($response->getRedirectUri());
} else {
    //Something went wrong
    echo 'Error: ' . $response->getStatus()->getStatusCode();
}

Example of implementation in our notification endpoint

<?php
$notification = $client->getNotification();
//Get external order Id and find in database
$notification->getOrder()->getExtOrderId();
//Check status
if ($notification->getOrder()->getStatus() === Yorki\Payu\Notifications\Schema\Order::STATUS_COMPLETED) {
    //you can extract buyer info from order
    $buyer = $notification->getOrder()->getBuyer();
    $buyerEmail = $buyer->getEmail();
    $buyerWholeData = $buyer->toArray();
}

Example of notification route

<?php
//api.php
Route::group([
    'prefix' => 'payu',
], function () {
    $this->post('notification', 'PayuController@notification');
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固