iOS SDK to use goSell API.
A library that fully covers payment/authorization/card saving process inside your iOS application.
- Requirements
- Installation
- Setup
- Usage
- SDK modes
- Pay Button
- Session
- API Session
- Session Data Source
- Session Delegate
- Payment Success Callback
- Payment Failure Callback
- Authorization Success Callback
- Authorization Failure Callback
- Card Saving Success Callback
- Card Saving Failure Callback
- Card Tokenization Success Callback
- Card Tokenization Failure Callback
- Session Is Starting Callback
- Session Has Started Callback
- Session Has Failed to Start Callback
- Session Cancel Callback
- Session Appearance
- Sample
To use the SDK the following requirements must be met:
- Xcode 10.0 or newer
- Swift 4.0 or newer (preinstalled with Xcode)
- Deployment target SDK for the app: iOS 11.0 or later
- To support apps below iOS 11 please use this command : pod "goSellSDK", '2.2.22'
CocoaPods is a dependency manager, which automates and simplifies the process of using 3rd-party libraries in your projects.
You can install it with the following command:
$ gem install cocoapods
To integrate goSellSDK into your Xcode 12+ project using CocoaPods, Please make sure you are using goSellSDK version >= 2.2.33
To integrate goSellSDK into your iOS 11+ Xcode project using CocoaPods, specify it in your Podfile
:
platform :ios, '12.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
target 'MyApp' do
pod 'goSellSDK'
end
Then, run the following command:
$ pod update
To integrate goSellSDK into your less than iOS 11 Xcode project using CocoaPods, specify it in your Podfile
:
platform :ios, '11.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
target 'MyApp' do
pod "goSellSDK", '2.2.22'
end
We also recommend you to include ErrorReporting submodule in order to allow your customers to report unexpected behaviour of the SDK directly to Tap.
To include error reporting, please add the following line to your Podfile
:
target 'MyApp' do
# Other pods
...
# Error reporting submodule.
pod 'goSellSDK/ErrorReporting'
end
You may face a compilation error when compiled using M1 based Mac devices, to solve this please follow these steps:
-
Close the Xcode.
-
Go to the
application
folder. -
Find the
Xcode
icon. -
Right click on Xcode icon.
-
Choose
Get info
-
Check the option
Open using Rosetta
Apple introduced in iOS 14+ an app on demand fashion called it "App Clip", where it gives the merchant the opportunity to provide his services on the go without the need for his customers to download an app.
In Tap we strive following the highest standards and utilising the latest provided technologies, hence we provided a comptible SDK to be embedded inside an App Clip target. The sdk is used exactly the same as this SDK code wise.
For more info please follow : goSellAppClipSDK
First of all, goSellSDK
should be set up. In this section only secret key is required.
Below is the list of properties in goSellSDK class you can manipulate. Make sure you do the setup before any usage of the SDK.
To set it up, add the following line of code somewhere in your project and make sure it will be called before any usage of goSellSDK
, otherwise an exception will be thrown. Required.
PS: This key is just a ‘Tap identifier’ for the application integrating with our SDK. Please don’t confuse it with public/secret keys used for encryption and decryption, which are stored safely on our PCI approved servers.
Swift:
let secretKey = SecretKey(sanbox: "YOUR_SANDBOX_SECRET_KEY", production: "YOUR_PRODUCTION_SECRET_KEY") // (format of the key: "sk_XXXXXXXXXXXXXXXXXXXXXXXX")
goSellSDK.secretKey = secretKey // Secret key (format: "sk_XXXXXXXXXXXXXXXXXXXXXXXX")
Objective-C:
SecretKey *secretKey = [[SecretKey alloc] initWithSandbox:@"YOUR_SANDBOX_SECRET_KEY" production:@"YOUR_PRODUCTION_SECRET_KEY"]; // (format of the key: "sk_XXXXXXXXXXXXXXXXXXXXXXXX")
[goSellSDK setSecretKey:secretKey];
Don't forget to import the framework at the beginning of the file:
Swift:
import goSellSDK
Objective-C:
@import goSellSDK;
or
#import <goSellSDK/goSellSDK-Swift.h>
SDK mode is a mode SDK is operating in, either sandbox or production.
Use this property to test your integration with the sandbox transactions.
WARNING: Default value of this property is production which means your transaction are real transactions. Switch to sandbox while in development.
Localization language of the UI part of the SDK. This is locale identifier.
Make sure it consists only from 2 lowercased letters and is presented in the list of availableLanguages property of goSellSDK class.
Notice: Starting from iOS 9 SDK user interface layout direction is based on the language you select, which means that if you would like to have it in Arabic language, the UI will be switched to RTL (right-to-left).
This property returns the list of locale identifiers the SDK is currently localized into.
Currently we support the following languages:
Language | Locale Identifier |
---|---|
Arabic | ar |
English | en |
Russian | ru |
This property returns current SDK version.
Resets all settings and makes the SDK to reinitialize on next usage.
Might be useful when you are switching accounts.
Also when you are logging the user out, although that's not required.
For those, who would like to use PayButton.
- Place PayButton.
- Assign its datasource and delegate.
- Implement datasource and delegate.
For those who would like to keep their design and start the SDK process manually.
- Create Session object.
- Assign its datasource and delegate.
- Implement datasource and delegate.
Make sure, your current goSellSDK version is >= 2.2.12-beta
-
Ask for the CSR from Tap team.
-
From your Apple Developer account:
-
-
Create a merchant identifier
A merchant identifier uniquely identifies you to Apple Pay as a merchant who is able to accept payments. You can use the same merchant identifier for multiple native and web apps. It never expires.
- In Certificates, Identifiers & Profiles, select Identifiers from the sidebar, then click the Add button (+) in the upper-left corner.
- Select Merchant IDs, then click Continue.
- Enter the merchant description and identifier name, then click Continue.
- Review the settings, then click Register.
-
Create Payment Processing Certificate:A payment processing certificate is associated with your merchant identifier and used to encrypt payment information. The payment processing certificate expires every 25 months. If the certificate is revoked, you can recreate it.
-
In Certificates, Identifiers & Profiles, select Identifiers from the sidebar.
-
Under Identifiers, select Merchant IDs using the filter in the top-right.
-
On the right, select your merchant identifier.
Note: If a banner appears at the top of the page saying that you need to accept an agreement, click the Review Agreement button and follow the instructions before continuing.
-
Under Apple Pay Payment Processing Certificate, click Create Certificate.
-
Create a certificate signing request on your Mac, and click Continue.
-
Click Choose File.
-
In the dialog that appears, select the certificate request file (a file with a
.certSigningRequest
file extension), then click Choose. -
Click Continue.
-
Click Download.
The certificate file (a file with a
.cer
file extension) appears in yourDownloads
folder.
-
-
-
Share your .cer file, merchant identifier and app bundle id back to Tap team.
-
Enable Apple Pay capability into your project from Xcode and select the merchant identifier.
-
Tap Apple Pay button will appear if:
- You did all the previous steps.
- The customer is paying with a currency that has Apple Pay option enabled from our side.
- The customer paying already activate Apple pay in his device.
- The customer paying has already added at least one valid card in his Apple Wallet with one our Apple pay payment networks.
After goSellSDK
is set up, you can actually use the SDK.
We have tried to make the SDK integration as simple as possible, requiring the minimum from you.
goSellSDK works in 4 modes:
- Purchase: Default mode. Normal customer charge.
- Authorize: Only authorization is happening. You should specify an action after successful authorization: either capture the amount or void the charge after specific period of time.
- Card Saving: Use this mode to save the card of the customer with Tap and use it later.
- Card Tokenization: Use this mode if you are willing to perform the charging/authorization manually. The purpose of this mode is only to collect and tokenize card information details of your customer if you don't have PCI compliance certificate but willing to process the payment manually using our services.
The mode is set through SessionDataSource interface.
Here at Tap, we have designed our custom Pay button and all you need to do is just to put it somewhere on the screen and provide at least required payment details through its dataSource
property.
Pay Button is restricted to the height of exactly 44 points. For better experience, make sure that it has enough width to display the content.
You can add Pay button on your view in XIB/Storyboard file. To do that, do the following:
- Drag & drop an instance of
UIView
at the desired location. - Select added view and open Identity Inspector
- Enter the following values:
- Class: PayButton
- Module: goSellSDK
- For your convenience, you may also connect
dataSource
anddelegate
outlets.
You can also add Pay button with the code:
Swift:
import goSellSDK
...
func addPayButton() {
let buttonFrame = CGRect(x: 8.0, y: UIScreen.main.bounds.height - 52.0, width: UIScreen.main.bounds.width - 16.0, height: 44.0)
let button = PayButton(frame: buttonFrame)
self.view.addSubview(button) // or where you want it
button.dataSource = self // or whatever
button.delegate = self // or whatever
}
Objective-C:
@import goSellSDK;
...
- (void)addPayButton {
CGRect buttonFrame = CGRectMake(8.0, UIScreen.mainScreen.bounds.size.height - 52.0, UIScreen.mainScreen.bounds.size.width - 16.0, 44.0);
PayButton *button = [[PayButton alloc] initWithFrame:buttonFrame];
[self.view addSubview:button]; // or where you want it
button.dataSource = self; // or whatever
button.delegate = self; // or whatever
}
Below is the list of Pay button properties
Property | Type | Description | ||
---|---|---|---|---|
Objective-C | Swift | Objective-C | Swift | |
enabled | isEnabled | BOOL | Bool | Defines whether the button is enabled. Perhaps you will need it for your internal logic. |
dataSource | id<SessionDataSource> | SessionDataSource | Session data source. All input payment information is passed through this protocol. Required. | |
delegate | id<SessionDelegate> | SessionDelegate | Session delegate. Payment status along with all output payment information is passed through this protocol. | |
appearance | id<SessionAppearance> | SessionAppearance | Session appearance. Implement only if you need UI customization. For more details please refer to SessionAppearance section. |
Method | Description | |
---|---|---|
Objective-C | Swift | |
- (void)updateDisplayedState | func updateDisplayedState() | Call this method to update displayed amount on the button. Note: If amount is non positive then pay button is force disabled. |
You want to use Session
object if you are not using PayButton
.
Property | Type | Description | ||
---|---|---|---|---|
Objective-C | Swift | Objective-C | Swift | |
dataSource | id<SessionDataSource> | SessionDataSource | Session data source. All input payment information is passed through this protocol. Required. | |
delegate | id<SessionDelegate> | SessionDelegate | Session delegate. Payment status along with all output payment information is passed through this protocol. | |
appearance | id<SessionAppearance> | SessionAppearance | Session appearance. Implement only if you need UI customization. For more details please refer to SessionAppearance section. | |
canStart | BOOL | Bool | Readonly. Defines if session can start with the data you have provided through the dataSource. |
Method | Description | |
---|---|---|
Objective-C | Swift | |
calculateDisplayedAmount | Calculates and returns an amount based on the details provided through the dataSource. You might want to call this method every time you update your dataSource to reflect changes in UI if you are not using PayButton provided by the SDK. Returns: Amount suggested to display to the customer or nil in the following cases:
|
|
start | Initiates the session. Returns: boolean value which determines whether all conditions are met to start the sesssion. |
|
stop | Stops the session. You might want to use this method when you need to close the SDK externally from your app, for example when performing a deep link. Arguments: completion: Completion closure that will be called once all opened user interface of the SDK will be dismissed. |
APISession is a class you want to use when you need to call plain APIs without the UI. Currently not all APIs are available.
Property | Type | Description | ||
---|---|---|---|---|
Objective-C | Swift | Objective-C | Swift | |
sharedInstance | shared | APISession | Shared singleton APISession instance. |
Please refer to APISession
class documentation for more details.
SessionDataSource is an interface which you should implement somewhere in your code to pass payment information in order to be able to access payment flow within the SDK.
The following table describes its structure and specifies which fields are required for each of the modes.
Member | Type | Required | Description | |||
---|---|---|---|---|---|---|
Objective-C | Swift | Purchase | Authorize | Card Saving | ||
mode | TransactionMode | false | Mode of the transactions (purchase, authorize, card saving or card tokenization). If this property is not implemented, purchase mode is used. | |||
customer | Customer | true | Customer information. For more details on how to create the customer, please refer to Customer class reference. | |||
currency | Currency | true | false | Currency of the transaction. | ||
amount | NSDecimal | Decimal | false | Payment/Authorization amount. Note: In order to have payment amount either amount or items should be implemented. If both are implemented, items is preferred. |
||
items | NSArray <PaymentItem *> | [PaymentItem] | false | List of items to pay for. Note: In order to have payment amount either amount or items should be implemented. If both are implemented, items is preferred. |
||
destinations | NSArray <Destination *> | [Destination] | false | The list of merchant desired destinations accounts to receive funds from payment/authorization transactions. | ||
merchantID | NSString | String | false | If you have multiple merchant accounts, please specify which one you would like to use through this field. | ||
taxes | NSArray <Tax *> | [Tax] | false | You can specify taxation details here. By default, there are no taxes. Note: Specifying taxes will affect total payment/authorization amount. |
||
shipping | NSArray <Shipping *> | [Shipping] | false | You can specify shipping details here. By default, there are no shipping details. Note: Specifying shipping will affect total payment/authorization amount. |
||
postURL | NSURL | URL | false | The URL which will be called by Tap system notifying that payment has either succeed or failed. | ||
paymentDescription | NSString | String | false | Description of the payment. | ||
paymentMetadata | NSDictionary <NSString *, NSString *> | [String: String] | false | Additional information you would like to pass along with the transaction. | ||
paymentReference | Reference | false | You can keep a reference to the transaction using this property. | |||
paymentStatementDescriptor | NSString | String | false | Statement descriptor. | ||
require3DSecure | BOOL | Bool | false | Defines if 3D secure check is required. If not implemented, treated as true. Note: If you disable 3D secure check, it still may occure. Final decision is taken by Tap. |
||
receiptSettings | Receipt | false | Receipt recipient details. | |||
authorizeAction | AuthorizeAction | false | true | false | Action to perform after authorization succeeds. | |
allowsToSaveSameCardMoreThanOnce | BOOL | Bool | false | Defines if same card can be saved more than once. Note: Same cards means absolutely equal data set. For example, if customer specifies same card details, but different cardholder names, we will treat this like different cards. |
||
applePayMerchantID | NSString | String | false | Defines the Apple pay merchant id you get from Apple developer account | ||
allowedCadTypes | NSArray<\CardType *> | [CardType] | false | Defines the allowed card types the merchant wants his clients to pay with (Credit, Debit, All) | ||
isSaveCardSwitchOnByDefault | BOOL | Bool | false | Defines if save card switch is on by default. Note: If value of this property is true, then switch will be remaining off until card information is filled and valid. And after will be toggled on automatically. |
||
paymentType | PaymentType | false | Defines payment types to show. | |||
cardHolderName | NSString | String | false | Provide a default card holder name to be written in the card input view. | ||
paymentType | PaymentType | false | Defines payment types to show. |
Objective-C
- (enum TransactionMode)mode {
return Purchase;
}
Swift
var mode: TransactionMode {
return .purchase
}
Objective-C
- (Customer *)customer {
if ( customerIDIsKnown ) {
return [self identifiedCustomer];
}
else {
return [self newCustomer];
}
}
/// Creating a customer with known identifier received from Tap before.
- (Customer *)identifiedCustomer {
return [[Customer alloc] initWithIdentifier:@"cus_tomer_id"];
}
/// Creating a customer with raw information.
- (Customer *)newCustomer {
EmailAddress *email = [EmailAddress withEmailAddressString:@"[email protected]"];
PhoneNumber *phoneNumber = [[PhoneNumber alloc] initWithISDNumber:@"965" phoneNumber:@"96512345"];
Customer *newCustomer = [[Customer alloc] initWithEmailAddress:email
phoneNumber:phoneNumber
firstName:@"Steve"
middleName:nil
lastName:@"Jobs"];
return newCustomer;
}
Swift
var customer: Customer? {
if customerIDIsKnown {
return self.identifiedCustomer
}
else {
return self.newCustomer
}
}
/// Creating a customer with known identifier received from Tap before.
var identifiedCustomer: Customer? {
return try? Customer(identifier: "cus_to_mer")
}
/// Creating a customer with raw information.
var newCustomer: Customer? {
let emailAddress = try! EmailAddress(emailAddressString: "[email protected]")
let phoneNumber = try! PhoneNumber(isdNumber: "965", phoneNumber: "96512345")
return try? Customer(emailAddress: emailAddress,
phoneNumber: phoneNumber,
firstName: "Steve",
middleName: nil,
lastName: "Jobs")
}
Tap supports processing payments in 10+ currencies, allowing you to charge customers in their native currency while receiving funds in yours. This is especially helpful if you have a global presence, as charging in a customer’s native currency can increase sales.
Currency | Code |
---|---|
UAE Dirham | AED |
Bahraini Dinar | BHD |
Egyptian Pound | EGP |
Euro | EUR |
UK Pound Sterling | GBP |
Kuwaiti Dinar | KWD |
Omani Riyal | OMR |
Qatari Riyal | QAR |
Saudi Riyal | SAR |
US Dollar | USD |
Objective-C
- (Currency *)currency {
return [Currency withISOCode:@"KWD"];
}
Swift
var currency: Currency? {
return .with(isoCode: "KWD")
}
Objective-C
- (NSDecimal)amount {
return [NSDecimalNumber one].decimalValue;
}
Swift
var amount: Decimal {
return 1.0
}
Objective-C
- (NSArray<PaymentItem *> *)items {
Quantity *oneUnit = [[Quantity alloc] initWithValue:[NSDecimalNumber one].decimalValue
unitOfMeasurement:[Measurement units]];
NSDecimal ten = [[NSDecimalNumber one] decimalNumberByMultiplyingByPowerOf10:1].decimalValue;
PaymentItem *firstItem = [[PaymentItem alloc] initWithTitle:@"Test item #1"
quantity:oneUnit
amountPerUnit:ten];
NSDecimal oneHundred = [[NSDecimalNumber one] decimalNumberByMultiplyingByPowerOf10:2].decimalValue;
Quantity *oneHundredSquareMeters = [[Quantity alloc] initWithValue:oneHundred unitOfMeasurement:[Measurement area:SquareMeters]];
NSDecimal seventeen = [NSDecimalNumber numberWithDouble:17.0].decimalValue;
AmountModificator *tenPercents = [[AmountModificator alloc] initWithPercents:ten];
NSDecimal oneThousand = [[NSDecimalNumber one] decimalNumberByMultiplyingByPowerOf10:3].decimalValue;
AmountModificator *thousandMoney = [[AmountModificator alloc] initWithFixedAmount:oneThousand];
Tax *thousandKD = [[Tax alloc] initWithTitle:@"KD 1,000.000" descriptionText:@"This is an example of a tax." amount:thousandMoney];
PaymentItem *secondItem = [[PaymentItem alloc] initWithTitle:@"Test item #2"
descriptionText:@"Test item #2 awesome description"
quantity:oneHundredSquareMeters
amountPerUnit:seventeen
discount:tenPercents
taxes:@[thousandKD]];
return @[firstItem, secondItem];
}
Swift
var items: [PaymentItem]? {
let oneUnit = Quantity(value: 1, unitOfMeasurement: .units)
let firstItem = PaymentItem(title: "Test item #1",
quantity: oneUnit,
amountPerUnit: 10)
let oneHundredSquareMeters = Quantity(value: 100,
unitOfMeasurement: .area(.squareMeters))
let tenPercents = AmountModificator(percents: 10)
let thousandMoney = AmountModificator(fixedAmount: 1000)
let thousandKD = Tax(title: "KD 1,000.000",
descriptionText: "This is an example of a tax.",
amount: thousandMoney)
let secondItem = PaymentItem(title: "Test item #2",
descriptionText: "Test item #2 awesome description.",
quantity: oneHundredSquareMeters,
amountPerUnit: 17,
discount: tenPercents,
taxes: [thousandKD])
return [firstItem, secondItem]
}
Objective-C
- (NSArray<Tax *> *)taxes {
NSDecimal fifteen = [NSDecimalNumber numberWithDouble:15.0].decimalValue;
AmountModificator *fifteenPercents = [[AmountModificator alloc] initWithPercents:fifteen];
Tax *fifteenPercentsTax = [[Tax alloc] initWithTitle:@"15 percents"
descriptionText:@"Just another fifteen percents."
amount:fifteenPercents];
return @[fifteenPercentsTax];
}
Swift
var taxes: [Tax]? {
let fifteenPercents = AmountModificator(percents: 15)
let fifteenPercentsTax = Tax(title: "15 percents",
descriptionText: "Just another fifteen percents",
amount: fifteenPercents)
return [fifteenPercentsTax]
}
Objective-C
- (NSArray<Shipping *> *)shipping {
NSDecimal fiveHundred = [NSDecimalNumber numberWithDouble:500.0].decimalValue;
Shipping *deliveryToHome = [[Shipping alloc] initWithName:@"Delivery"
descriptionText:@"Delivery to Home"
amount:fiveHundred];
return @[deliveryToHome];
}
Swift
var shipping: [Shipping]? {
let deliveryToHome = Shipping(name: "Delivery",
descriptionText: "Delivery to Home",
amount: 500)
return [deliveryToHome]
}
Objective-C
- (NSURL *)postURL {
return [NSURL URLWithString:@"https://tap.company/post"];
}
Swift
var postURL: URL? {
return URL(string: "https://tap.company/post")
}
Objective-C
- (NSString *)paymentDescription {
return @"Awesome payment description will be here.";
}
Swift
var paymentDescription: String? {
return "Awesome payment description will be here.";
}
Objective-C
- (NSDictionary<NSString *,NSString *> *)paymentMetadata {
return @{@"note": @"some note",
@"internal_linking_id": @"id3424141414"};
}
Swift
var paymentMetadata: [String : String]? {
return [
"note": "some note",
"internal_linking_id": "id3424141414"
]
}
Objective-C
- (Reference *)paymentReference {
return [[Reference alloc] initWithTransactionNumber:@"tr_2352358020f"
orderNumber:@"ord_2352094823"];
}
Swift
var paymentReference: Reference? {
return Reference(transactionNumber: "tr_2352358020f",
orderNumber: "ord_2352094823")
}
Objective-C
- (NSString *)paymentStatementDescriptor {
return @"Payment statement descriptor will be here";
}
Swift
var paymentStatementDescriptor: String? {
return "Payment statement descriptor will be here"
}
Objective-C
- (BOOL)require3DSecure {
return YES;
}
Swift
var require3DSecure: Bool {
return true
}
Objective-C
- (Receipt *)receiptSettings {
return [[Receipt alloc] initWithEmail:YES sms:YES];
}
Swift
var receiptSettings: Receipt? {
return Receipt(email: true, sms: true)
}
Objective-C
- (AuthorizeAction *)authorizeAction {
AuthorizeAction *captureAfterTwoHours = [AuthorizeAction captureAfterTimeInHours:2];
return captureAfterTwoHours;
}
Swift
var authorizeAction: AuthorizeAction {
return .capture(after: 2)
}
Objective-C
- (BOOL)allowsToSaveSameCardMoreThanOnce {
return NO;
}
Swift
var allowsToSaveSameCardMoreThanOnce: Bool {
return false
}
Objective-C
-(NSString *)applePayMerchantID
{
return @"merchant.com.example";
}
Swift
var applePayMerchantID: String
{
return "merchant.com.example"
}
Objective-C
- (NSArray<CardType *> *)allowedCadTypes {
CardType* credit = [[CardType alloc]initWithCardType:Credit];
CardType* debit = [[CardType alloc]initWithCardType:Debit];
return @[credit,debit];
}
Swift
var allowedCadTypes: [CardType]? {
return [CardType(cardType: .Debit), CardType(cardType: .Credit)]
}
SessionDelegate is an interface which you may want to implement to receive payment/authorization/card saving status updates and update your user interface accordingly when payment window closes.
Below are listed down all available callbacks:
Notifies the receiver that payment has succeed. Can be called only in purchase mode.
Objective-C:
- (void)paymentSucceed:(Charge * _Nonnull)charge onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func paymentSucceed(_ charge: Charge, on session: SessionProtocol)
charge: Successful charge object.
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that payment has failed. Can be called only in purchase mode.
Objective-C:
- (void)paymentFailedWithCharge:(Charge * _Nullable)charge error:(TapSDKError * _Nullable)error onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func paymentFailed(with charge: Charge?, error: TapSDKError?, on session: SessionProtocol)
charge: Charge object that has failed (if reached the stage of charging).
error: An error that has occured (if any).
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
You may assume that at least one, charge
or error
is not nil
.
Notifies the receiver that authorization has succeed. Can be called only in authorization mode.
Objective-C:
- (void)authorizationSucceed:(Authorize * _Nonnull)authorize onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func authorizationSucceed(_ authorize: Authorize, on session: SessionProtocol)
authorize: Successful authorize object.
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that authorization has failed. Can be called only in authorization mode.
Objective-C:
- (void)authorizationFailedWithAuthorize:(Authorize * _Nullable)authorize error:(TapSDKError * _Nullable)error onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func authorizationFailed(with authorize: Authorize?, error: TapSDKError?, on session: SessionProtocol)
authorize: Authorize object that has failed (if reached the stage of authorization).
error: An error that has occured (if any).
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
You may assume that at least one, authorize
or error
is not nil
.
Notifies the receiver that the customer has successfully saved the card. Can be called only in card saving mode.
Objective-C:
- (void)cardSaved:(CardVerification * _Nonnull)cardVerification onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func cardSaved(_ cardVerification: CardVerification, on session: SessionProtocol)
cardVerification: Card verification object with the details.
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that the customer failed to save the card. Can be called only in card saving mode.
Objective-C:
- (void)cardSavingFailedWithCardVerification:(CardVerification * _Nullable)cardVerification error:(TapSDKError * _Nullable)error onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func cardSavingFailed(with cardVerification: CardVerification?, error: TapSDKError?, on session: SessionProtocol)
cardVerification: Card verification object with the details (if reached the stage of card saving).
error: Error that has occured. If nil
, please refer to the cardVerification
object for error details.
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that card token has successfully created. Can be called only in card tokenization mode.
Objective-C:
- (void)cardTokenized:(Token * _Nonnull)token onSession:(id <SessionProtocol> _Nonnull)session customerRequestedToSaveTheCard:(BOOL)saveCard;
Swift:
func cardTokenized(_ token: Token, on session: SessionProtocol, customerRequestedToSaveTheCard saveCard: Bool)
token: Token of the card provided by your customer. session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton. saveCard: Boolean flag which determines whether the customer wants to save the card. Actual card saving process is not happening.
Notifies the receiver that card token has failed to be created. Can be called only in card tokenization mode.
Objective-C:
- (void)cardTokenizationFailedWithError:(TapSDKError * _Nonnull)error onSession:(id <SessionProtocol> _Nonnull)session;
Swift:
func cardTokenizationFailed(with error: TapSDKError, on session: SessionProtocol)
error: Error that has occured. session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that session is about to start, but hasn't yet shown the SDK UI. You might want to use this method if you are not using PayButton
in your application and want to show a loader before SDK UI appears on the screen. Will be called in all modes.
Objective-C:
- (void)sessionIsStarting:(id <SessionProtocol> _Nonnull)session;
Swift:
func sessionIsStarting(_ session: SessionProtocol)
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that session has successfully started and shown the SDK UI on the screen. You might want to use this method if you are not using PayButton
in your application and want to hide a loader after SDK UI has appeared on the screen. Will be called in all modes.
Objective-C:
- (void)sessionHasStarted:(id <SessionProtocol> _Nonnull)session;
Swift:
func sessionHasStarted(_ session: SessionProtocol)
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that session has failed to start and will not show the SDK UI on the screen. You might want to use this method if you are not using PayButton
in your application and want to hide a loader because the session has failed. For the actual failure cause please implement other methods from this protocol and listen to the callbacks. Will be called in all modes.
Objective-C:
- (void)sessionHasFailedToStart:(id <SessionProtocol> _Nonnull)session;
Swift:
func sessionHasFailedToStart(_ session: SessionProtocol)
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
Notifies the receiver that payment/authorization was cancelled by user. Will be called in all modes.
Objective-C:
- (void)sessionCancelled:(id <SessionProtocol> _Nonnull)session;
Swift:
func sessionCancelled(_ session: SessionProtocol)
session: Session object. It can be either a PayButton or an instance of Session if you are not using PayButton.
You might want to implement SessionAppearance
protocol if you need some UI customization to match your user interface and provide great user experience.
Please refer to SessionAppearance
class documentation to see what kind of customization is currently available.
Sample application integration is available in Example folder.
Documentation is available at github-pages.
Also documented sources are attached to the library.