mwanziamutua/omnipay-pesapal

Omnipay支付处理库的Pesapal V3网关

v1.0.0.01 2022-11-12 21:58 UTC

This package is auto-updated.

Last update: 2024-09-13 02:28:40 UTC


README

Pesapal API v3驱动程序,用于Omnipay PHP支付处理库

Omnipay是一个与框架无关、多网关的PHP 7.2+支付处理库。本包实现了Omnipay的最新Pesapal API支持。

Pesapal网关API 文档

安装

此包通过Composer安装。要安装,只需将其添加到您的composer.json文件中。

composer require mwanziamutua/pesapal

基本用法

本包提供了以下网关:

  • Pesapal

您需要设置您的consumerKeyconsumerSecret。将testMode设置为true将使用sandbox环境。

处理客户订单如下:

$gateway = GatewayFactory::createInstance($consumerKey, $consumerSecret, true);

try {
    $orderNo = uniqid('', true);
    $returnUrl = 'https://:80/gateway-return.php';
    $notifyUrl = 'http://127.0.0.1/online-payments/uuid/notify';
    $ipnId = ' b62dbd97-3b95-43d2-8969-df616360f0ab';
    $description = 'Shopping at myAwesomeStore.com';

    $pesapalOrder = [
        'purchaseData' => [
            'id' => $orderNo,
            'amount'            => 150,
            'currency'          => 'KES',
            'description' => $description,
            'callback_url' => $returnUrl,
            'notification_id' => $ipnId,
            'billing_address'  => [
                "email_address" => "john.doe@example.com",
                "phone_number" => null,
                "country_code" => "",
                "first_name" => "John",
                "middle_name" => "",
                "last_name" => "Doe",
                "line_1" => "",
                "line_2" => "",
                "city" => "",
                "state" => "",
                "postal_code" => null,
                "zip_code" => null
            ]
        ],
    ];


    $response = $gateway->purchase($pesapalOrder);

有关通用使用说明,请参阅主要的Omnipay仓库。

支持

如果您在使用Omnipay时遇到一般性问题,我们建议在Stack Overflow上发布。请务必添加omnipay标签,以便易于查找。

如果您想了解发布公告,讨论项目想法或提出更详细的问题,还有一个您可以订阅的邮件列表

如果您认为您找到了一个错误,请使用GitHub问题跟踪器报告,或者最好是分支库并提交一个pull请求。