sirumobile/payum-siru

Siru Mobile 支付网关的 Payum 扩展

0.1.0 2022-11-16 09:08 UTC

This package is auto-updated.

Last update: 2024-09-16 13:36:27 UTC


README

此库允许使用 Payum 与 Siru Mobile 支付。

要求

  • PHP 8.0+
  • Siru Mobile 的 API 凭证

安装

composer require sirumobile/payum-siru

配置

您需要从 Siru Mobile 获取您的 API 凭证和集成详情。有关更完整的支付流程示例,请参阅 EXAMPLE

<?php

use Payum\Core\GatewayFactoryInterface;
use Siru\PayumSiru\PayumSiruGatewayFactory;
use Payum\Core\PayumBuilder;
use Payum\Core\Payum;

/** @var Payum $payum */
$payum = (new PayumBuilder())
    ->addDefaultStorages()
    ->addGatewayFactory('siru_checkout', function(array $config, GatewayFactoryInterface $coreGatewayFactory) {
        return new PayumSiruGatewayFactory($config, $coreGatewayFactory);
    })
    ->addGateway('siru_checkout', [
        'factory' => 'siru_checkout',
        # These are only example values. Replace these with values you received from Siru Mobile
        'merchant_id' => 123,
        'merchant_secret' => 'yoursecret',
        'variant' => 'variant2',
        'purchase_country' => 'FI',
        'service_group' => 2,
        'tax_class' => 3,
    ])
    ->getPayum()
;