定制 shaz3e/peach-payment 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

shaz3e/peach-payment

最新稳定版本:1.0.1

Composer 安装命令:

composer require shaz3e/peach-payment

包简介

Peach payment hosted checkout

README 文档

README

Total Downloads Latest Stable Version License

Install Peach Payment in Laravel

composer require shaz3e/peach-payment

Add service provider

'providers' => [
    Shaz3e\PeachPayment\Providers\PeachPaymentServiceProvider::class,
]

Publish the config file

php artisan vendor:publish --tag=peach-payment-config

Update .env Data

php artisan update:peach-payment-config

How to Use

Watch YouTube Video Tutorials with details instructions and customization

YouTube Video

use Shaz3e\PeachPayment\Helpers\PeachPayment;

// Use the following code within your controller method
/**
 * Update in .env previously and get it from config
 */
$entityId = config('peach-payment.entity_id');
/**
 * Dynamic amount should be float
 * It can be passed via request
 */
$amount = (float) $request->amount;
/**
 * Return URL is optional
 * If you want user to redirect to another URL of your approved domain you can use the following
 * Do not use / at the beginnig of the $return_url as it will generate URL i.e. config('peach-payment.domain').'/'.$return_url.'/?PeachPaymentOrder='.$order_number
 */
$return_url = 'after-main-domain/route/sub-route/?PeachPaymentOrder=OID123456789'; // Optional

/**
 * Create new request for PeachPayment helper
 */
$peachPayment = new  PeachPayment();
/**
 * Generate token and initiate the request
 */
$checkoutData = $peachPayment->createCheckout($amount);
/**
 * Optional
 * Get Order Number if you want to update record in database
 * suggest me this is just for reconcile purpose
 * $checkoutData['order_number'] = OID.time()
 */
$order_number = $checkoutData['order_number'];
/**
 * CheckoutId is unique id generated by PeachPayment
 * This should be passed to render the form in blade template
 */
$checkoutId = $checkoutData['checkoutId'];
return  view('your.view', compact('entityId', 'checkoutId'));

In your.view use the following code.

<div id="payment-form"></div>
<script src="{{ config('peach-payment.' . config('peach-payment.environment') . '.embedded_checkout_url') }}"></script>
<script>
    const checkout = Checkout.initiate({
        key: "{{ $entityId }}",
        checkoutId: "{{ $checkoutId }}",
    });

    checkout.render("#payment-form");
</script>

When you run php artisan update:peach-payment-config it will ask you the following.

  1. What is your PEACHPAYMENT_ENVIRONMENT?
  2. What is your PEACHPAYMENT_ENTITY_ID?
  3. What is your PEACHPAYMENT_CLIENT_ID?
  4. What is your PEACHPAYMENT_CLIENT_SECRET?
  5. What is your PEACHPAYMENT_MERCHANT_ID?
  6. What is your PEACHPAYMENT_DOMAIN?
  7. What is your PEACHPAYMENT_CURRENCY?

After updating env data visit yourwebsite.com/peachpayment and it will fatch token and initiate the checkout at PeachPayment

Test Credit Cards https://developer.peachpayments.com/docs/reference-test-and-go-live

Contributing

License

Peach Payment Embed Checkout with Laravel is licensed under the MIT license. Enjoy!

Credit

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-24