PHP SDK

SumUp provides a library that allows smoother integration into the SumUp's API. It is written in PHP as one of the most requested by developers programming language. It is designed to facilitate payment integrators, developers and other interested parties when building payment checkout experiences and provides easier access to other services like:

  • managing merchant profiles
  • managing checkouts
  • managing customers
  • managing payouts
  • querying transactions

Installation

The SumUp eCom PHP SDK can be installed with Composer. Run the following command:

composer require sumup/sumup-ecom-php-sdk

Basic usage

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();
}

SDK documentation

For more information read the documentation.