2017 © Pedro Peláez
 

library sumup-php

SumUp PHP Library

image

alexcode/sumup-php

SumUp PHP Library

  • Tuesday, May 1, 2018
  • by alexcode
  • Repository
  • 1 Watchers
  • 3 Stars
  • 207 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 47 % Grown

The README.md

SumUp PHP SDK

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

This repo is archived, please use the official Sumup PHP SDK., (*2)

Requirements

PHP 5.6 and later., (*3)

Composer

You can install the bindings via Composer. Run the following command:, (*4)

composer require alexcode/sumup-php

Basic Usage

Setup your credentials, (*5)

Sumup\Sumup::setClientSecret('MY_CLIENT_SECRET');
Sumup\Sumup::setClientId('MY_CLIENT_ID');
Sumup\Sumup::setRedirectUri('MY_OAUTH_REDIRECT');

OAuth

As a merchant, you will need to Authorize your app to make requests on your behalf with OAuth, (*6)

Authorization Code Grant

Get the authorize Url to redirect your merchant to., (*7)

SumUp doc Authorization Code Grant, (*8)

Sumup\OAuth::authorizeUrl(['scope' => 'payments']);
// https://api.sumup.com/authorize?scope=payments&client_id=MY_CLIENT_ID&redirect_uri=MY_OAUTH_REDIRECT&response_type=code

Upon accepting the dialog, the merchant browser will hit your redirect URI with the code in the GET parameter (ex: http://MY_OAUTH_REDIRECT/?code=246d97b0b730c61f5929drfb3a444948fd54c058d0416019), (*9)

Therefore, you can create an Access Token to act on behalf of your Merchant., (*10)

Get Access Token

$access_token = Sumup\OAuth::getToken([
  'grant_type' => 'authorization_code',
  'code' => '246d97b0b730c61f5929drfb3a444948fd54c058d0416019'
]);

Refresh Access Token

SumUp doc Refresh Tokens, (*11)

$refreshed = Sumup\OAuth::refreshToken($access_token);

Checkout

Create the checkout server-side

SumUp doc Create checkout API, (*12)

$checkout = Sumup\Checkout::create([
  'amount' => 20,
  'currency' => 'EUR',
  'checkout_reference' => 'MY_REF',
  'pay_to_email' => 'MY_CUSTOMER_EMAIL',
]);

echo $checkout->getCompleteUrl();
// https://api.sumup.com/v0.1/checkouts/123456

Complete the checkout client-side

Use the URL to complete the payment in the client browser. Therefore, no PCI data is ever hitting your server., (*13)

SumUp doc Complete checkout API, (*14)

PUT https://api.sumup.com/v0.1/checkouts/123456

body:
{
  "payment_type": "card",
  "card": {
    "name": "...",
    "number": "...",
    "expiry_year": "...",
    "expiry_month": "...",
    "cvv": "..."
  }
}

Note that a checkout can be completed in a browser only from a domain that is present in your OAuth setup as an authorized javascript origin(s)., (*15)

List of currently implemented SumUp API

Checkouts API

  • [x] Create checkout
  • [x] Complete checkout
  • [ ] Create customer
  • [ ] Get payment instruments
  • [ ] Create payment instrument
  • [ ] Disable payment instrument

Transactions API

  • [ ] Transaction history
  • [ ] Transaction details
  • [x] Refund transaction
  • [ ] Receipt data

Accounts API

  • [ ] Get account
  • [ ] Get personal profile
  • [ ] Create personal profile
  • [ ] Get merchant profile
  • [ ] Create merchant profile
  • [ ] Get DBA
  • [ ] Edit DBA
  • [ ] Get Bank Accounts
  • [ ] Create Bank Accounts
  • [ ] Payouts Get settings
  • [ ] Payouts Edit settings
Accounts API Employee
  • [ ] Create Employee
  • [ ] Get Employees
  • [ ] Change employee credentials
Accounts API Shelf
  • [ ] Get shelves
  • [ ] Create shelf
  • [ ] Create shelf
  • [ ] Edit shelf
  • [ ] Delete shelf
Accounts API Product
  • [ ] Get products
  • [ ] Create product
  • [ ] Get product
  • [ ] Edit product
  • [ ] Delete product
  • [ ] Get product prices
  • [ ] Create product price
  • [ ] Get product price
  • [ ] Edit product price
  • [ ] Delete product price
Accounts API Application Settings
  • [ ] Application Get settings
  • [ ] Application Edit settings

Credits

This Library is loosely inspired from Stripe PHP, (*16)

The Versions

01/05 2018

dev-master

9999999-dev

SumUp PHP Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Couturon

rest sumup

01/05 2018

v0.0.5

0.0.5.0

SumUp PHP Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Couturon

rest sumup

06/04 2018

v0.0.4

0.0.4.0

SumUp PHP Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Couturon

rest sumup

27/02 2018

v0.0.3

0.0.3.0

SumUp PHP Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Couturon

rest sumup