承接 kiakaha/chargily-v2 相关项目开发

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

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

kiakaha/chargily-v2

Composer 安装命令:

composer require kiakaha/chargily-v2

包简介

README 文档

README

Symfony Plugin for Chargily v2 ePay Gateway Installation

Chargily ePay Gateway

Installation

  1. Via Composer (Recomended)
composer require kiakaha/chargily-v2
  1. Register the bundle, add this line at the end of the file config/bundles.php
Chargily\V2Bundle\ChargilyV2Bundle::class => ['all' => true]
  1. Import the services, Add the follow line in config/services.yml
imports:
services:
....
Chargily\V2Bundle\Service\HandleRequest\ChargilySendRequest:
        public: true
  1. Configure the api keys Add the follow line in config/services.yml
parameters:
    .......
    sandbox_url: 'Your test URL'
    live_url: 'Your Live URL'
    public_key: "Your Public KEY"
    secret_key: "Your Secret KEY"
    dev: Boolean true|flase
  1. Create Product Method
    #[Route('/chargily/create/product', name: 'create_new_product', methods: ['GET'])]
    public function createNewProduct(ChargilySendRequest $sendRequest)
    {
        $payload = json_encode(["name" => "Super Product"]);
        $response = $sendRequest->createNewProduct($payload);
        if ($response->getStatusCode() == 200) {
            $response = json_decode($response->getContent());
            return new JsonResponse([
                "id" => $response->id ?? null,
                "entity" => $response->entity ?? null,
                "livemode" => $response->livemode ?? null,
                "name" => $response->name ?? null,
                "description" => $response->description ?? null,
                "images" => $response->images ?? null,
                "metadata" => $response->metadata ?? null,
                "created_at" => $response->created_at ?? null,
                "updated_at" => $response->updated_at ?? null
            ]);
        } else {
            $response = json_decode($response->getContent());
            return new JsonResponse($response);
        }
    }
  1. Create Price Method
    #[Route('/chargily/create/price', name: 'create_price', methods: ['GET'])]
    public function createPrice(ChargilySendRequest $sendRequest)
    {
        $payload = json_encode(["amount" => 5000,
            "currency" => "dzd",
            "product_id" => "01hnwn32spw57bz2b4m52rdjrh"]);
        return $sendRequest->createPrice($payload);
    }
  1. Create checkout Method
#[Route('/chargily/create/checkout', name: 'create_checkout', methods: ['GET'])]
    public function createCheckout(ChargilySendRequest $sendRequest)
    {
        $payload = json_encode(["items" =>
            [[
                "price" => "01hntrjg31kkxebqzxk37xzhp8",
                "quantity" => 1
            ]],
            "success_url" => "https://your-cool-website.com/payments/success"
        ]);
        return $sendRequest->createCheckout($payload);
    }
  1. Webhook Method
      /**
     * @Route("/chargily/webhook/checkout",name="webhook_checkout")
     * @throws \Exception
     */
    public function webhookCheckout(ChargilySendRequest $sendRequest, Request $request)
    {
        $response = $sendRequest->webhookCheckout($request);
        return $response;
    }  
  1. this is a full controller for the implementations
<?php

namespace App\Controller;

use Chargily\V2Bundle\Service\HandleRequest\ChargilySendRequest;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Attribute\Route;

class ChargilyEpaySymfonyController extends AbstractController
{

    #[Route('/chargily/create/product', name: 'create_new_product', methods: ['GET'])]
    public function createNewProduct(ChargilySendRequest $sendRequest)
    {
        $payload = json_encode(["name" => "Super Product"]);
        $response = $sendRequest->createNewProduct($payload);
        if ($response->getStatusCode() == 200) {
            $response = json_decode($response->getContent());
            return new JsonResponse([
                "id" => $response->id ?? null,
                "entity" => $response->entity ?? null,
                "livemode" => $response->livemode ?? null,
                "name" => $response->name ?? null,
                "description" => $response->description ?? null,
                "images" => $response->images ?? null,
                "metadata" => $response->metadata ?? null,
                "created_at" => $response->created_at ?? null,
                "updated_at" => $response->updated_at ?? null
            ]);
        } else {
            $response = json_decode($response->getContent());
            return new JsonResponse($response);
        }
    }

    #[Route('/chargily/create/price', name: 'create_price', methods: ['GET'])]
    public function createPrice(ChargilySendRequest $sendRequest)
    {
        $payload = json_encode(["amount" => 5000,
            "currency" => "dzd",
            "product_id" => "01hnwn32spw57bz2b4m52rdjrh"]);
        return $sendRequest->createPrice($payload);
    }

    #[Route('/chargily/create/checkout', name: 'create_checkout', methods: ['GET'])]
    public function createCheckout(ChargilySendRequest $sendRequest)
    {
        $payload = json_encode(["items" =>
            [[
                "price" => "01hntrjg31kkxebqzxk37xzhp8",
                "quantity" => 1
            ]],
            "success_url" => "https://your-cool-website.com/payments/success"
        ]);
        return $sendRequest->createCheckout($payload);
    }

    /**
     * @Route("/chargily/webhook/checkout",name="webhook_checkout")
     * @throws \Exception
     */
    public function webhookCheckout(ChargilySendRequest $sendRequest, Request $request)
    {
        $response = $sendRequest->webhookCheckout($request);
        return $response;
    }
}

Contribution tips

  1. Make a fork of this repo.
  2. Take a tour to our API documentation here
  3. Get your API Key/Secret from ePay by Chargily V2 For test Mode ePay by Chargily V2 For live Mode dashboard for free.
  4. Start developing.
  5. Finished? Push and merge.

kiakaha/chargily-v2 适用场景与选型建议

kiakaha/chargily-v2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 kiakaha/chargily-v2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kiakaha/chargily-v2 我们能提供哪些服务?
定制开发 / 二次开发

基于 kiakaha/chargily-v2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-02-04