@globy-app/capacitor-sumup
v0.1.0
Published
Capacitor plugin to connect capacitor based applications to the native SumUp SDK to take card payments.
Downloads
2
Readme
capacitor-sumup
Capacitor plugin to connect capacitor based applications to the native SumUp SDK to take card payments.
Install
npm install capacitor-sumup
npx cap sync
Compatibility of this plugin
The aim of this plugin is to be as close to the Native SDK's as possible. This means that the returned result code and message is chosen by the SDK and the SDK probably has the correct documentation on how to interpret the code / message.
Android
The complete function set of this plugin is implemented on Android. This is the reference implementation.
Web
Sumup does not provide a way to integrate the SDK on web. The SumUp Payment Switch API does exist but cannot be integrated as nicely as the native SDK's. The native SDK's allow waiting for the user to return to the application, web application don't support this.
IOS
Not implemented yet.
Requirements
See SumUp Android SDK documentation on how to setup your account to accept calls from the SDK.
API
login(...)
logout()
makePayment(...)
openCardReaderPage()
prepareForCheckout()
- Interfaces
- Type Aliases
- Enums
login(...)
login(options: LoginOptions) => Promise<SumupResponse>
Logout the user
| Param | Type | Description |
| ------------- | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| options
| LoginOptions | Options to use when loggin in. Must contain an affiliate key matching the bundle identifier of the application. |
Returns: Promise<SumupResponse>
logout()
logout() => Promise<void>
Logout the user
makePayment(...)
makePayment(options: PaymentOptions) => Promise<CheckoutResponse>
Trigger a payment. SumUp will open a window that helps the user letting the customer pay.
| Param | Type | Description |
| ------------- | --------------------------------------------------------- | ---------------------- |
| options
| PaymentOptions | Options of the payment |
Returns: Promise<CheckoutResponse>
openCardReaderPage()
openCardReaderPage() => Promise<SumupResponse>
Opens a page to configure a SumUp card reader on the device. May never resolve, this is due to SumUp's implementation.
Returns: Promise<SumupResponse>
prepareForCheckout()
prepareForCheckout() => Promise<void>
Offers the possibility to connect the card reader ahead of initiating the checkout which speeds up the overall checkout time.
Interfaces
SuccesSumupResponse
| Prop | Type |
| ---------------- | --------------------------------------------------------------- |
| ResultCode
| SuccessResultCode |
| Message
| string |
ErrorSumupResponse
| Prop | Type |
| ---------------- | ----------------------------------------------------------- |
| ResultCode
| ErrorResultCode |
| Message
| string |
LoginOptions
| Prop | Type |
| ------------------ | ------------------- |
| affiliatekey
| string |
SuccessCheckoutResponse
| Prop | Type |
| --------------------- | --------------------------------------------------------------- |
| ResultCode
| SuccessResultCode |
| Message
| string |
| TransactionCode
| string |
| TransactionInfo
| TransactionInfo |
| ReceiptSent
| boolean |
TransactionInfo
| Prop | Type |
| -------------------------- | ------------------------------------------------------- |
| TransactionCode
| string |
| MerchantCode
| string |
| Amount
| number |
| ForeignTransactionId
| string |
| Currency
| Currency |
| PaymentStatus
| PaymentStatus |
| PaymentType
| PaymentType |
| EntryMode
| string |
| CardType
| string |
PaymentOptions
| Prop | Type |
| -------------------------- | --------------------------------------------- |
| total
| number |
| currency
| Currency |
| title
| string |
| receiptEmail
| string |
| receiptSMS
| string |
| additionalInfo
| { [key: string]: string; } |
| foreignTransactionId
| string |
| skipSuccessScreen
| boolean |
| skipFailedScreen
| boolean |
Type Aliases
SumupResponse
SuccesSumupResponse | ErrorSumupResponse
CheckoutResponse
SuccessCheckoutResponse | ErrorSumupResponse
Enums
SuccessResultCode
| Members | Value |
| ---------------- | -------------- |
| SUCCESSFUL
| 1 |
ErrorResultCode
| Members | Value |
| ----------------------------------- | --------------- |
| ERROR_TRANSACTION_FAILED
| 2 |
| ERROR_GEOLOCATION_REQUIRED
| 3 |
| ERROR_INVALID_PARAM
| 4 |
| ERROR_INVALID_TOKEN
| 5 |
| ERROR_NO_CONNECTIVITY
| 6 |
| ERROR_PERMISSION_DENIED
| 7 |
| ERROR_NOT_LOGGED_IN
| 8 |
| ERROR_DUPLICATE_FOREIGN_TX_ID
| 9 |
| ERROR_INVALID_AFFILIATE_KEY
| 10 |
| ERROR_ALREADY_LOGGED_IN
| 11 |
| ERROR_INVALID_AMOUNT_DECIMALS
| 12 |
| ERROR_API_LEVEL_TOO_LOW
| 13 |
Currency
| Members | Value |
| --------- | ------------------ |
| BGN
| "BGN" |
| BRL
| "BRL" |
| CHF
| "CHF" |
| CLP
| "CLP" |
| COP
| "COP" |
| CZK
| "CZK" |
| DKK
| "DKK" |
| EUR
| "EUR" |
| GBP
| "GBP" |
| HRK
| "HRK" |
| HUF
| "HUF" |
| NOK
| "NOK" |
| PEN
| "PEN" |
| PLN
| "PLN" |
| RON
| "RON" |
| SEK
| "SEK" |
| USD
| "USD" |
PaymentStatus
| Members | Value |
| ---------------- | ------------------------- |
| PENDING
| "PENDING" |
| SUCCESSFUL
| "SUCCESSFUL" |
| CANCELLED
| "CANCELLED" |
| FAILED
| "FAILED" |
PaymentType
| Members | Value |
| --------------- | ------------------------ |
| CASH
| "CASH" |
| POS
| "POS" |
| ECOM
| "ECOM" |
| UNKNOWN
| "UNKNOWN" |
| RECURRING
| "RECURRING" |
| BITCOIN
| "BITCOIN" |
| BALANCE
| "BALANCE" |