coreproc/paymaya-laravel 问题修复 & 功能扩展

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

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

coreproc/paymaya-laravel

Composer 安装命令:

composer require coreproc/paymaya-laravel

包简介

Paymaya SDK for Laravel

README 文档

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Paymaya SDK for Laravel

Installation

You can install the package via composer:

composer require coreproc/paymaya-laravel

You can publish and run the migrations with:

You can publish the config file with:

php artisan vendor:publish --provider="Coreproc\Paymaya\PaymayaServiceProvider" --tag="config"

This is the contents of the published config file:

return [

    'environment' => env('PAYMAYA_ENVIRONMENT', PayMayaClient::ENVIRONMENT_SANDBOX),
    
    'key' => env('PAYMAYA_KEY'),

    'secret' => env('PAYMAYA_SECRET'),

    'webhooks' => [

        'checkout_success' => env('PAYMAYA_WEBHOOKS_CHECKOUT_SUCCESS'),

        'checkout_failure' => env('PAYMAYA_WEBHOOKS_CHECKOUT_FAILURE'),

        'checkout_dropout' => env('PAYMAYA_WEBHOOKS_CHECKOUT_DROPOUT'),

        'payment_success' => env('PAYMAYA_WEBHOOKS_PAYMENT_SUCCESS'),

        'payment_failed' => env('PAYMAYA_WEBHOOKS_PAYMENT_FAILED'),

        'payment_expired' => env('PAYMAYA_WEBHOOKS_PAYMENT_EXPIRED'),

    ],

];

Usage

Creating a payment

use CoreProc\PayMaya\PayMayaClient;
use CoreProc\PayMaya\Requests\Address;
use Coreproc\PaymayaLaravel\Builders\PaymayaCheckoutBuilder;
use Coreproc\PaymayaLaravel\Facades\PaymayaCheckoutClientFacade;

$checkout = PaymayaCheckoutBuilder::make()
    ->setCurrency('PHP')
    ->setItem($paymayaItemModel, 1)
    ->setDiscount(1000)
    ->setServiceCharge(1001)
    ->setShippingFee(1002)
    ->setTax(1003)
    ->setBuyerFirstName('Juan')
    ->setBuyerMiddleName('D')
    ->setBuyerLastName('Dela Cruz')
    ->setBuyerContactPhone('09171231234')
    ->setBuyerContactEmail('juan@gmail.com')
    ->setBuyerShippingAddress(Address::make()->setLine1('123 Daan')->setCity('Quezon City'))
    ->setBuyerBillingAddress(Address::make()->setLine1('456 Highway')->setCity('Makati City'))
    ->setReferenceNumber('100')
    ->setRedirectUrlSuccess('https://yoursite.com/success')
    ->setRedirectUrlFailure('https://yoursite.com/failure')
    ->setRedirectUrlCancel('https://yoursite.com/cancel')
    ->build();

$response = PaymayaCheckoutClientFacade::post($checkout);

$result = PayMayaClient::getDataFromResponse($response);

return redirect()->to($result->redirectUrl);

Installing the webhooks

php artisan paymaya:install-webhook

This command will register all webhooks defined in the configuration file. To register only the webhooks you need, remove webhooks from the array.

You can also refer to the webhook's callback URL using the route name.

<?php
return [
    'webhooks' => [
        'payment_success' => 'hooks.paymaya.success',
        'payment_failed' => 'hooks.paymaya.failed',
        'payment_expired' => 'hooks.paymaya.expired',
    ],
];

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固