Documentation

Borgun, all rights reserved. 2017 ©

Introduction

Borgun Mobilepay for iOS is a library that supports accepting payments on mobile using RPG.

Installation

Import the following files and files into the project and make sure the target membership for all these files is selected for the application’s build target.

  • libBorgunPaymentLib.a - The library file itself
  • ResourceBundle.bundle - all resources connected to the Library
  • PaymentViewController.h - View controller that handles the payment
  • PaymentSubscriptionAPI.h - provides API for handling preauthorised payments

In your project's Build Settings (in the TARGETS section, not the PROJECTS section), add -lc++ to Other Linker Flags.

Required frameworks (weak linking is supported):

  • Accelerate
  • AudioToolbox
  • AVFoundation
  • CoreGraphics
  • CoreMedia
  • CoreVideo
  • Foundation
  • MobileCoreServices
  • OpenGLES
  • QuartzCore
  • Security
  • UIKit

Usage

Create a view controller of PaymentViewController type and set it up with the following parameters:

Name Description
AuthToken
Required
Authorization token provided to the developer by Borgun. See Access tokens introduction in RPG documentation
Scheme
Required
URL scheme for the library, development or production URLs are called based on the parameter.
  • UrlSchemeDev
  • UrlSchemeProduction
Amount
Required
Payment amount (exact float value). Regions where currencies only exist in integer values, the amount displayed is rounded up, but the API processes the exact same amount entered.
PaymentMethod
Required
Enum whether payment method is type Sale or PreAuthorization.
CurrencyCode
Required
Enum of supported currencies.
  • CurrencyISK, //Icelandic Krona
  • CurrencyCZK, //Czech Republic Koruna
  • CurrencyEUR, //Euro
  • CurrencyUSD, //US Dollar
  • CurrencyGBP, //British Pound
  • CurrencyDKK, //Danish Krone
  • CurrencyNOK, //Norwegian Krone
  • CurrencySEK, //Swedish Krona
  • CurrencyCHF, //Swiss Franc
  • CurrencyCAD, //Canadian Dollar
  • CurrencyHUF, //Hungarian Forint
  • CurrencyBHD, //Bahraini Dinar
  • CurrencyAUD, //Australian Dollar
  • CurrencyRUB, //Russian Ruble
  • CurrencyPLN, //Polish Zloty/li>
  • CurrencyRON, //Romanian Leu
  • CurrencyHRK, //Croatian Kuna
OrderId
Required
Order Id generated by the merchant for inventory and order tracking.
UserKey
Required
String to identify the user that is making the purchase, since each user has his/her own card details stored in case of express checkouts.
AllowedCards
Required
Supported card types, depends on region. List of supported cards:
  • AUCreditCardTypeVisaElectron
  • AUCreditCardTypeVisa
  • AUCreditCardTypeMasterCard
  • AUCreditCardTypeMaestro
  • AUCreditCardTypeAmex
  • AUCreditCardTypeDiscover
  • AUCreditCardTypeDiners
  • AUCreditCardTypeUnionPay
  • AUCreditCardTypeJCB
ResultBlock
Required
Block that returns whether payment was successful.
Arguments: (BOOL result,id responseObject) result = YES means payment was successful, check responseObject dictionary for transaction details; result = NO means payment failed, responseObject is a string with error message.
CompletionBlock
Required
Called when payment is successful and PaymentViewController is about to be dismissed. Use it for UI updating when PaymentViewController is dismissed.
PaymentLanguage
Optional
Enum of supported languages
  • PaymentLanguageEnglish
  • PaymentLanguageCzech
  • PaymentLanguageIcelandic
colorAccents
Optional
Color of accents in the views. (SHOULD NOT BE CLEAR COLOR)
colorTextsInputs
Optional
Color of text values input by user (CAN BE SAME AS colorAccents BUT SHOULD NOT BE CLEAR COLOR).
colorSectionBackground
Optional
Background color of input fields (CAN BE CLEAR COLOR BUT SHOULD BE DIFFERENT FROM colorAccents and colorTextsInputs).
DisclaimerViewTheme
Optional
Enum whether light or dark, choose the one that fits the application’s background/colorSectionBackground.
backgroundImage
Optional
type UIImage, can be any image that covers the background of the payment view controller, contentMode is UIViewContentModeScaleAspectFill.
backgroundColor
Optional
Choose the background color for the PaymentViewController’s view.

Additional API features

If and only if PaymentMethod == PaymentMethodPreAuth:

Use PaymentSubscriptionAPI in case of cancel, refund or capture of a payment.

Method for doing so:

+ (void)makeRequest:(MerchantRequest)request
          AuthToken:(NSString *)authToken
   forTransactionId:(NSString*)transactionId
   WithBlockSuccess:(void(^)(id responseObject))blockSuccess
            failure:(void(^)(id responseObject))blockFailure;

MerchantRequest: enum of the following types -

  • MerchantRequestCancel
  • MerchantRequestRefund
  • MerchantRequestCapture

AuthToken: same authorization token as in section 2.

TransactionId: Transaction id returned by the API after making the preauthorized payment.

blockSuccess: Success block (check responseObject)

blockFailure: Failure block (check responseObject)

Limitiations

  • PaymentViewController should only be in portrait mode, landscape mode is not supported. If the entire application is not in portrait mode, just force the orientation of PaymentViewController to be in portrait mode.
  • Fonts can not be changed, default font “itc-officina-sans-lt” is used in the entire library.