sumup/sumup-ecom-php-sdk

SumUp eCom SDK for PHP

1.2.0 2023-12-19 08:49 UTC

This package is auto-updated.

Last update: 2024-09-19 10:18:20 UTC


README

概述

此存储库包含开源PHP SDK,允许您快速集成SumUp的API端点。

安装

SumUp eCom PHP SDK可以使用Composer安装。运行以下命令

composer require sumup/sumup-ecom-php-sdk

基本用法

try {
    $sumup = new \SumUp\SumUp([
        'app_id'     => 'YOUR-CLIENT-ID',
        'app_secret' => 'YOUR-CLIENT-SECRET',
        'code'       => 'YOUR-AUTHORIZATION-CODE'
    ]);
    $checkoutService = $sumup->getCheckoutService();
    $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail);
    $checkoutId = $checkoutResponse->getBody()->id;
//  pass the $chekoutId to the front-end to be processed
} catch (\SumUp\Exceptions\SumUpAuthenticationException $e) {
    echo 'Authentication error: ' . $e->getMessage();
} catch (\SumUp\Exceptions\SumUpResponseException $e) {
    echo 'Response error: ' . $e->getMessage();
} catch(\SumUp\Exceptions\SumUpSDKException $e) {
    echo 'SumUp SDK error: ' . $e->getMessage();
}

API参考

有关类别的完整列表,请参阅API参考页面

常见问题解答

路线图

许可证

有关许可证信息,请参阅许可证文件

联系我们

如果您发现了一个错误或缺少某些功能,请提交问题。如果您在集成SumUp API时遇到其他问题,可以发送电子邮件至integration@sumup.com