pallapay/pallapay-php-sdk
Composer 安装命令:
composer require pallapay/pallapay-php-sdk
包简介
Pallapay PHP SDK to accept crypto currency payments.
README 文档
README
Easy to use SDK for pallapay crypto payment gateway, accept crypto in your website and get paid in cash.
Installation
composer require pallapay/pallapay-php-sdk
Easy to use
First signup, create API Key and get you ApiKey, SecretKey from Pallapay website
Then you can create a payment:
use Pallapay\PallapaySDK\PallapayClient; $apiKey = "YOUR_API_KEY"; $secretKey = "YOUR_SECRET_KEY"; $pallapayClient = new PallapayClient($apiKey, $secretKey); $createdPayment = $pallapayClient->payment()->create( 'AED', '100', 'johndoe@gmail.com', 'https://yourwebsite.com/success', 'https://yourwebsite.com/failed', 'https://yourwebsite.com/webhook', // Optional 'John', // Optional 'Doe', // Optional 'My Custom Note', // Optional 'Order ID' // Optional //'USDT', // (paymentCurrencySymbol => Force the user to pay only in the selected currency, for example: USDT, ETH, ...) Optional ); echo $createdPayment["data"]["payment_link"];
create method params:
| Name | Description | Required |
|---|---|---|
| $symbol | Currency of the payment | YES |
| $amount | Amount in selected currency | YES |
| $payerEmailAddress | Payer email address | YES |
| $ipnSuccessUrl | The URL that we redirect the user after successful payment | YES |
| $ipnFailedUrl | The URL that we redirect the user after unsuccessful payment | YES |
| $webhookUrl | Webhook URL (If webhookUrl is NULL pallapay will send notifications to default webhook URL that you entered while creating your API Key) | NO |
| $payerFirstName | Payer first name | NO |
| $payerLastName | Payer last name | NO |
| $note | You can pass any custom note here. for example, your customer ID. This item is not displayed to the buyer (You will receive this in your webhook URL too) | NO |
| $orderId | You can pass a "unique" order id here. This item is not displayed to the buyer as well (You will receive this in your webhook URL too) | NO |
| $paymentCurrencySymbol | Force the user to pay only in the selected cryptocurrency, for example: USDT, ETH, ... (If you dont provide anything user can pay using any cryptocurrency) | NO |
After that you can redirect user to payment_link.
Handle IPN notifications
After user payment was done, we will call your WEBHOOK_URL that you entered when you created your API Key.
In that page you can use this getIpnData method to get payment details and then verify it.
use Pallapay\PallapaySDK\PallapayClient; $apiKey = "YOUR_API_KEY"; $secretKey = "YOUR_SECRET_KEY"; $pallapayClient = new PallapayClient($apiKey, $secretKey); $jsonData = file_get_contents('php://input'); $data = json_decode($inputJson, TRUE); $ipnData = $pallapayClient->payment()->getIpnData($data); if ($ipnData->isValid() && $ipnData->isPaid()) { print_r($ipnData->getAll()) echo 'Paid Successfully'; } else { echo 'Not Paid'; }
IpnData Available methods:
| method | Description |
|---|---|
| isValid | Check if IPN request was valid (Was really sent from Pallapay) |
| isPaid | Check if user payment status was PAID |
| getAll | Get everything from IPN request in an array |
| getPaymentRequestId | Unique ID of created payment |
| getPaymentAmount | Payment amount in selected currency |
| getPaymentCurrency | Selected fiat currency to pay |
| getPayerEmailAddress | Payer email address |
| getStatus | Payment status (PAID or UNPAID) |
| getReceivingAmount | The amount that you will receive in your Pallapay balance (After fees, if applicable) |
| getReceivingCurrency | The currency that you will receive in your Pallapay balance |
| getPaidCryptocurrency | The cryptocurrency your user selected to pay with |
| getFeeAmount | Payment fee in selected fiat currency |
| getFeePaidBy | Who paid the fees on this payment (You can choose who pay for fees in dashboard -> API Keys) |
| getPayerFirstName | Payer first name |
| getPayerLastName | Payer last name |
| getRefId | User payment reference ID |
| getPaidAt | Payment was done at (date/time) |
| getNote | Custom note that you pass in creation time |
| getOrderId | Unique order ID that you pass in creation time |
Available methods
$pallapayClient->payment()->create()$pallapayClient->payment()->getAll()$pallapayClient->payment()->getByPaymentRequestId()$pallapayClient->balance()->getAll()$pallapayClient->balance()->getBySymbol()
Contribution
Contributions are highly appreciated either in the form of pull requests for new features, bug fixes or just bug reports.
pallapay/pallapay-php-sdk 适用场景与选型建议
pallapay/pallapay-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「gateway」 「crypto」 「bitcoin」 「pallapay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pallapay/pallapay-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pallapay/pallapay-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pallapay/pallapay-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
High-level cryptographic primitives and security utilities for Maatify systems including password hashing, reversible encryption, HKDF key derivation, and key rotation.
Client library to send SMS using Comilio SMS Gateway API (https://www.comilio.it)
A simple PHP Cryptography Implementation for the Ark Blockchain.
A simple PHP API client for the Ark Blockchain.
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-04