FuseTools integration of iOS and Android sumup sdk
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
SumupSDK.embeddedframework
AndroidImpl.uno
Fuse.sumup.unoproj
MainView.ux
README.md
Simulator Screen Shot 31 août 2017 à 09.07.04.png
Simulator Screen Shot 31 août 2017 à 09.09.18.png
Simulator Screen Shot 31 août 2017 à 09.09.46.png
iOSImpl.uno
js.uno
sumup.uxl

README.md

Fuse.Sumup

Integration available

iOS and Android

# Prerequisites

Registered for a merchant account via SumUp's country websites (or received a test account). Received SumUp card terminal: Air, Air Lite, PIN+ terminal or Chip & Signature reader. Requested an Affiliate (Access) Key via SumUp Dashboard for Developers. Deployment Target iOS 6.0 or later. Xcode 7 and iOS SDK 9 or later. iPhone, iPad or iPod touch.

Things to add for ios

  1. Add -ObjC to "Other Linker Flags" if not yet included
  2. Add the bundles provided in SumupSDK.embeddedframework/Resources to your app target.
 SumupSDK.embeddedframework/Resources/SMPSharedResources.bundle
 SumupSDK.embeddedframework/Resources/YTLibResources.bundle

sdk Initialisation

Before operating the sdk needs to be initialized

  var Sumup = require("Sumup")
  Sumup.Initialize()

Login

Following app authentication, a registered SumUp merchant account needs to be logged in

  function Login(){
    return Sumup.Login().then(function(results){
        console.log(results + " " + i'm logged in") 
    }, function(err){
        console.log(JSON.stringify(err))
    })
  }

Payment

Once logged in, you can start using the SumUp SDK to accept card payments. you can perform checkout request this way by specifying the price, title name below product productTitle, and a unique identifier for the payment named below foreignKey

  function Pay(){
    if(!price.value || !productTitle.value || !foreignKey.value){
      console.log("error")
    }else{
        return Sumup.Pay(price.value, productTitle.value, foreignKey.value).then(function(results){
          console.log("payment successfull")
      }, function(err){
        console.log("error")
      })
    }
  }

Pay with accessToken

Sumup gives you the possibility to make payments without having to log in using a token access.

    function GetToken(){
      console.log(JSON.stringify("haha i started"))
      return new Promise(function(resolve, reject){
        return fetch("https://api.sumup.com/token", {
          method: 'POST',
          headers: { 'Content-type': 'application/json', 'content-length': 211 },
          body: JSON.stringify({
            grant_type: 'password',
            client_id: 'YourClientID',
            client_secret: 'YourClientSecret',
            username: 'Yourusername@sumup.com',
            password: 'Password'
          })
        }).then(function(results){
          switch (results.status) {
            case 200:
              return results.json()
              break;
            default:
              reject()
          }
        }).then(function(data){
          resolve(data)
        })
    })
  }




  function PayWithToken(){
      if(!price.value || !productTtile.value || !foreignKey.value){
          console.log("error")
      }else{
          GetToken().then(function(results){
        if(results.access_token){
          return Sumup.PayWithToken(results.access_token, price.value, productTtile.value, foreignKey.value).then(function(results){
            console.log(JSON.stringify(results))
          }, function(err){
            console.log(JSON.stringify(err))
          })


        }else{
          console.log(JSON.stringify("erreur"))
        }
    })
    }
  
  }

Update checkout preferences

When logged in you can let merchants check and update their checkout preferences. Merchants can select their preferred card terminal and set up a new one if needed. The preferences available to a merchant depend on their respective account settings.

  function OpenPreference(){
    return Sumup.Preferences()
  }

Logout

  function logout(){
    return Sumup.Logout()
  }