kadirov/payme
Composer 安装命令:
composer require kadirov/payme
包简介
README 文档
README
Installation
Install the package
composer req kadirov/payme
Add to config/bundles.php
Kadirov\Payme\PaymeBundle::class => ['all' => true],
Create AfterFinishPaymentInterface and BeforeCancelFinishedPayment classes. Add next to config/services.yaml
services: Kadirov\Payme\Component\Billing\Payment\Payme\Interfaces\BeforeCancelFinishedPaymentInterface: class: App\Component\Payme\BeforeCancelFinishedPayment Kadirov\Payme\Component\Billing\Payment\Payme\Interfaces\AfterFinishPaymentInterface: class: App\Component\Payme\AfterFinishPayment
Add next lines to your .env file
### Payme PAYME_CASHBOX_ID="" PAYME_CASHBOX_KEY="" PAYME_CASHBOX_TEST_ID=Paycom PAYME_CASHBOX_TEST_KEY="" PAYME_CHECK_IPS=true PAYME_IPS="185.234.113.1,185.234.113.2,185.234.113.3,185.234.113.4,185.234.113.5,185.234.113.6,185.234.113.7,185.234.113.8,185.234.113.9,185.234.113.10,185.234.113.11,185.234.113.12,185.234.113.13,185.234.113.14,185.234.113.15" ### Payme
Add payme route to config/packages/security.yaml file
security: firewalls: payme: pattern: ^/api/payments/payme security: false methods: - post
How to use
Create PaymeTransaction via createTransaction() method of PaymeTransactionBuilder. For fiscalization you can also call addItem() method.
Example of simple using
$paymeTransaction = $paymeTransactionBuilder ->createTransaction($price) ->getResult();
Example with fiscalization
$paymeTransaction = $paymeTransactionBuilder ->createTransaction($finalPrice) ->addItem('10315002001000000', 3, '195815', $consultingPrice, 'Consulting services', 15) ->addItem('10305005001000000', 1, '195763', $softwarePrice, 'Software Development', 15) ->getResult();
When user pays this payment, system will call afterFinishPayment() method of AfterFinishPaymentInterface. So, create class which implements AfterFinishPaymentInterface.
Also, you have to implement BeforeCancelFinishedPaymentInterface . Method in this class will call before cancel a payment. If canceling payment is impossible you can throw BeforeCancelFinishedPaymentException .
How to connect your project with Payme
You should create cashbox on merchant.payme.uz. Then copy ID and specify it as value of PAYME_CASHBOX_ID
Enter to the cashbox, click to settings then developer tools where you can find key and test key. Specify them as values of PAYME_CASHBOX_KEY and PAYME_CASHBOX_TEST_KEY
Also, you have to enter Endpoint URL like to https://my-domain.com/api/payments/payme
Click to tab Payment details and create transactionId
Add next form and users can pay by clicking the button
<!-- Start Payme Form --> <form method="POST" action="https://checkout.paycom.uz"> <!-- Use https://test.checkout.paycom.uz URL for testing --> <!-- Payme Cashbox ID --> <input type="hidden" name="merchant" value="{{ PAYME_CASHBOX_ID }}"/> <!-- Cost with tiyin --> <input type="hidden" name="amount" value="{{ transaction.amount }}"/> <!-- Payment data --> <input type="hidden" name="account[transactionId]" value="{{ transaction.id }}"/> <!-- === OPTIONAL DATA === --> <!-- Language. By default 'ru'. Available options: ru|uz|en --> <input type="hidden" name="lang" value="{{ lang }}"/> <!-- Currency. By default '860'. Available options: 643|840|860|978 643 - RUB 840 - USD 860 - UZS 978 - EUR --> <input type="hidden" name="currency" value="860"/> <!-- URL to redirecting after payment. By default, payme redirects to URL of Referer header value. URL may contain that will be replaced by Payme: :transaction - id of transaction. Can be null if payme couldn't create transaction :account.{field} - field of account object For example: https://your-service.com/payme/:transaction --> <!-- <input type="hidden" name="callback" value="{{ REDIRECT_URL }}"/> --> <!-- Redirect timeout after successful payment in milliseconds --> <input type="hidden" name="callback_timeout" value="15"/> <!-- Payment description. You can also specify descriptions in few languages by using description object like name="description[{lang}]". As {lang} you can use ru, en or uz --> <input type="hidden" name="description" value="{{ PAYME_DESCRIPTION }}"/> <!-- Details of payment. You can use JSON object encoded by BASE64. For example: { "discount": { "title": "discount 5%", "price": 10000 }, "shipping": { "title": "Shipment to Termez 28/23", "price": 500000 }, "items": [ { "title": "Tomato", "price": 505000, "count": 2 } ] } --> <button type="submit" >Pay with <b>Payme</b></button> </form>
kadirov/payme 适用场景与选型建议
kadirov/payme 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 385 次下载、GitHub Stars 达 7, 最近一次更新时间为 2022 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kadirov/payme 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kadirov/payme 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 385
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-02-18


