0.1.0 • Published 1 year ago

@globy-app/capacitor-sumup v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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(...)

login(options: LoginOptions) => Promise<SumupResponse>

Logout the user

ParamTypeDescription
optionsLoginOptionsOptions 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.

ParamTypeDescription
optionsPaymentOptionsOptions 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

PropType
ResultCodeSuccessResultCode
Messagestring

ErrorSumupResponse

PropType
ResultCodeErrorResultCode
Messagestring

LoginOptions

PropType
affiliatekeystring

SuccessCheckoutResponse

PropType
ResultCodeSuccessResultCode
Messagestring
TransactionCodestring
TransactionInfoTransactionInfo
ReceiptSentboolean

TransactionInfo

PropType
TransactionCodestring
MerchantCodestring
Amountnumber
ForeignTransactionIdstring
CurrencyCurrency
PaymentStatusPaymentStatus
PaymentTypePaymentType
EntryModestring
CardTypestring

PaymentOptions

PropType
totalnumber
currencyCurrency
titlestring
receiptEmailstring
receiptSMSstring
additionalInfo{ key: string: string; }
foreignTransactionIdstring
skipSuccessScreenboolean
skipFailedScreenboolean

Type Aliases

SumupResponse

SuccesSumupResponse | ErrorSumupResponse

CheckoutResponse

SuccessCheckoutResponse | ErrorSumupResponse

Enums

SuccessResultCode

MembersValue
SUCCESSFUL1

ErrorResultCode

MembersValue
ERROR_TRANSACTION_FAILED2
ERROR_GEOLOCATION_REQUIRED3
ERROR_INVALID_PARAM4
ERROR_INVALID_TOKEN5
ERROR_NO_CONNECTIVITY6
ERROR_PERMISSION_DENIED7
ERROR_NOT_LOGGED_IN8
ERROR_DUPLICATE_FOREIGN_TX_ID9
ERROR_INVALID_AFFILIATE_KEY10
ERROR_ALREADY_LOGGED_IN11
ERROR_INVALID_AMOUNT_DECIMALS12
ERROR_API_LEVEL_TOO_LOW13

Currency

MembersValue
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

MembersValue
PENDING"PENDING"
SUCCESSFUL"SUCCESSFUL"
CANCELLED"CANCELLED"
FAILED"FAILED"

PaymentType

MembersValue
CASH"CASH"
POS"POS"
ECOM"ECOM"
UNKNOWN"UNKNOWN"
RECURRING"RECURRING"
BITCOIN"BITCOIN"
BALANCE"BALANCE"
0.1.0

1 year ago