shamsuddeen/sudo-php

用于Sudo Africa API的PHP包装器

1.0.0 2024-02-12 09:13 UTC

This package is not auto-updated.

Last update: 2024-09-23 12:56:04 UTC


README

Sudo Africa的PHP库

使用方法

从Packagist安装包

composer require Shamsuddeen/sudo-php

函数命名约定

函数名称基于以下文档命名,文档位于此处

添加客户(来自文档)变为

$sudo->addCustomer()

如下示例代码所示

示例代码

创建客户

<?php
require_once 'vendor/autoload.php';
use SudoAfrica\Sudo;

$sudo = new Sudo\Sudo('13337b87ee76gew87fg87gfweugf87w7ge78f229c', true); // true for Sandbox; false for Live
$client_data = [
    "type" => "individual",
    "status" => "active",
    "name" => "Shamsuddeen Omacy",
    "phoneNumber" => "07012345678",
    "emailAddress" => "omacy@mail.ng",
    "individual" => [
        "firstName" => "Shamsuddeen",
        "lastName" => "Omacy",
        "otherNames" => "",
        "dob" => "1988/12/23",
        "identity" => [
            "type" => "BVN",
            "number" => "12345678901"
        ],
        "documents" => [
            "idFrontUrl" => "link",
            "idBackUrl" => "link",
            "addressVerificationUrl" => "link"
        ]
    ],
    "billingAddress" => [
        "line1" => "4 Barnawa Close",
        "line2" => "Off Challawa Crescent",
        "city" => "Barnawa",
        "state" => "Kaduna",
        "country" => "NG",
        "postalCode" => "800001"
    ]
];

$sudo->addCustomer($client_data);
?>

获取客户

<?php
    $sudo->getCustomers();
?>

创建卡片

创建卡片并设置消费限额,如果您未设置spendingLimits,则将应用默认值。

<?php
    $data = [
        "customerId" => "64771cdfce4b094addfcba4a",
        "fundingSourceId" => "61e5655b1e32bc4c04dea28b",
        "debitAccountId" => "61e5747a1e32bc4c04dea85c",
        "brand" => "MasterCard",
        "type" => "virtual",
        "currency" => "USD",
        "issuerCountry" => "USA",
        "status" => "active",
        "spendingControls" => [
            "allowedCategories" => [],
            "blockedCategories" => [],
            "channels" => [
                "atm" => true,
                "pos" => true,
                "web" => true,
                "mobile" => true
            ],
            "spendingLimits" => [
                [
                    "interval" => "daily",
                    "amount" => 20000
                ],
                [
                    "interval" => "weekly",
                    "amount" => 1000000
                ],
                [
                    "interval" => "monthly",
                    "amount" => 100000000
                ]
            ]
        ],
        "sendPINSMS" => false
    ];
    $result = $sudo->createCard($data);
?>