pomelopay/pomelopay-connect-php
Composer 安装命令:
composer require pomelopay/pomelopay-connect-php
包简介
PHP Bindings for the Pomelo Pay Connect API
README 文档
README
PHP API Client and bindings for the Pomelo Pay Connect API
Using this PHP API Client you can interact with your Pomelo Pay Connect API:
- 💳 Transactions
Installation
Requires PHP 7.2.5 or higher
The recommended way to install pomelopay-connect-php is through Composer:
First, install Composer:
$ curl -sS https://getcomposer.org/installer | php
Next, install the latest pomelopay-connect-php:
$ php composer.phar require pomelopay/pomelopay-connect-php
Finally, you need to require the library in your PHP application:
require "vendor/autoload.php";
Development
- Run
composer testandcomposer phpcsbefore creating a PR to detect any obvious issues. - Please create issues for this specific API Binding under the issues section.
- Contact Pomelo Pay directly for Pomelo Pay Connect API support.
Quick Start
PomeloPayConnect\Client
First get your production or sandbox API key from your Dashboard.
If you want to get a production client:
use PomeloPayConnect\Client; $client = new Client('apikey', 'appid');
If you want to get a sandbox client:
use PomeloPayConnect\Client; $client = new Client('apikey', 'appid', 'sandbox');
If you want to pass additional GuzzleHTTP options:
use PomeloPayConnect\Client; $options = ['headers' => ['foo' => 'bar']]; $client = new Client('apikey', 'appid', 'sandbox', $options);
If you want to pass a custom base URL:
use PomeloPayConnect\Client; $options = ['baseUrl' => 'my-custom-url']; $client = new Client('apikey', 'appid', 'sandbox', $options);
Available API Operations
The following exposed API operations from the Pomelo Pay Connect API are available using the API Client.
See below for more details about each resource.
💳 Transactions
Create a new transaction with or without a specific payment method.
Usage details
💳 Transactions
Create transaction with a specific payment method
use PomeloPayConnect\Client; $client = new Client('apikey', 'appid'); $json = [ "provider" => "card", // Payment method enabled for your merchant account such as bcmc, card, card "currency" => "GBP", "amount" => 1000, // 10.00 GBP "redirectUrl" => "https://foo.bar/order/123" // Optional redirect after payment completion ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction->url); // Go to transaction payment page
Create transaction without a payment method that will redirect to the payment method selection screen
use PomeloPayConnect\Client; $client = new Client('apikey', 'appid'); $json = [ "currency" => "GBP", "amount" => 1000, // 10.00 GBP "redirectUrl" => "https://foo.bar/order/987" // Optional redirect after payment completion ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction->url); // Go to payment method selection screen
Create transaction without a payment method with your own localId that will redirect to the payment method selection screen
use PomeloPayConnect\Client; // Get your API Key and App ID from the "Connect" screen on your merchant dashboard $client = new Client('apikey', 'appid'); // Currency should be your merchant account currency or the payment would be rejected $json = [ "currency" => "EUR", "amount" => 1234, // 12.34 EUR, "localId" => "INVOICE-2020-0001", "redirectUrl" => "https://your.webshop.domain.url/my_order/2020_0001" // Optional redirect after payment completion, the payment portal will redirect to this URL and attach queryParameters to this URL, fully optional ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction->url); // Go to payment screen on Pomelo Pay die();
Create transaction without a payment method with your own localId that will redirect to the payment method selection screen and also sends a webhook for this specific transaction
use PomeloPayConnect\Client; // Get your API Key and App ID from the "Connect" screen on your merchant dashboard $client = new Client('apikey', 'appid'); // Currency should be your merchant account currency or the payment would be rejected $json = [ "currency" => "EUR", "amount" => 1234, // 12.34 EUR, "localId" => "INVOICE-2020-0001", "webhook" => "https://foo.bar/incoming/1234", "redirectUrl" => "https://your.webshop.domain.url/my_order/2020_0001" // Optional redirect after payment completion, the payment portal will redirect to this URL and attach queryParameters to this URL, fully optional ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction->url); // Go to payment screen on Pomelo Pay die();
Create transaction without a payment method with your own localId that will redirect to the payment method selection screen and also sends a webhook for this specific transaction. Furthermore expire this payment link automatically after 3 hours.
use PomeloPayConnect\Client; // Get your API Key and App ID from the "Connect" screen on your merchant dashboard $client = new Client('apikey', 'appid'); // Currency should be your merchant account currency or the payment would be rejected $json = [ "currency" => "EUR", "amount" => 1234, // 12.34 EUR, "validForHours" => 3, "localId" => "INVOICE-2020-0001", "webhook" => "https://foo.bar/incoming/1234", "redirectUrl" => "https://your.webshop.domain.url/my_order/2020_0001" // Optional redirect after payment completion, the payment portal will redirect to this URL and attach queryParameters to this URL, fully optional ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction->url); // Go to payment screen on Pomelo Pay die();
About
⭐ Sign up as a merchant at https://dashboard.pomelopay.com and start receiving payments in seconds.
pomelopay/pomelopay-connect-php 适用场景与选型建议
pomelopay/pomelopay-connect-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.42k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「pay」 「alipay」 「online payments」 「pomelo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pomelopay/pomelopay-connect-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pomelopay/pomelopay-connect-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pomelopay/pomelopay-connect-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Payyo Gateway for the Omnipay payment processing library
A PSR-7 compatible library for making CRUD API endpoints
Библиотека для приема платежей через Альфабанк.
Some pre-defined rules for validation in Omnipay payment processing library.
BluePay gateway for the Omnipay payment processing library
支付宝接口扩展包
统计信息
- 总下载量: 5.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-12