Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
If you’re using Cocoapods, you can add the SDK by adding the dependency to your Podfile
Followed by performing:
Both the Klarna Payments native integration and the hybrid integration are available under the KlarnaMobileSDK module.
KlarnaMobileSDK
A Payment View in iOS is called a KlarnaPaymentView. Rendering a payment view consists of creating an instance of the view, passing it an event listener and, adding it to your view hierarchy.
KlarnaPaymentView
You can initialize the KlarnaPaymentView by providing a return URL and the event listener.
category
eventListener
The SDK will notify you of events via an event listener that you’ll need to implement. It acts as a conventional delegate on iOS, however, unlike a delegate, it’s not optional.
The payment view does not define any height internally. This is because we want to allow you to handle height changes in whichever way is most convenient to you.
The payment view instead notifies you through the event listener you provide it.
WORKING WITH A PAYMENT VIEW
We expose six methods on the payment view that you can use to interact with the payment method it’s presenting:
Before content is rendered into a payment view, it needs to be configured. You can do this by initializing the view.
After the view has been added and set up, you’ll need to call initialize() with the clientToken you received from the back-end and a returnURL.
initialize()
clientToken
returnURL
returnUrl
If successful klarnaInitialized() will be called in the listener you supplied. If it’s not successful klarnaFailed() will be called instead.
klarnaInitialized()
klarnaFailed()
paymentView
Once you’ve initialized the view and you’re ready to display SDK of the KlarnaPaymentView.
Simply call load(), supplying an optional string with updated order data to update the session. This string should be formatted as a valid JSON.
load()
jsonData
If successful klarnaLoaded()will be called in your listener. If anything went wrong, klarnaFailed()it will be called.
klarnaLoaded()
And if you’ve loaded several views, you should keep track of which view your user selected to know what to authorize in the next step.
When the payment view SDK is loaded, and the user has confirmed that they want to pay with one of Klarna’s selected payment methods, it’s time to authorize the session.
When you are ready to authorize the session, call authorize(). As with load, you can supply an optional string to update the session. You can also specify whether auto-finalization should be turned off; if it is, the user may need to be prompted a second time to input data.
authorize()
autoFinalize
If successful klarnaAuthrized() will be called in your listener. If not, klarnaFailed() it will be called.
approved
authToken
finalizedRequired
There are cases when you might want to allow your customer to change their order after it has been authorized (e.g. in some form of order/summary view). In these cases, if the order or customer details have changed, you’ll need to reauthorize the session.
If successful, klarnaReauthorized() will be called, and if not, klarnaFailed() will be called instead.
klarnaReauthorized()
If the session needs to be finalized, you’ll need to perform this last step to get an authorization token.
Call finalise() in order to get the token.
finalise()
While we tend to name all finalize operations “finalize” with a “z”, all classes subclassing fromNSObjectalready have a conflicting finalize()method. In this specific case, we use alternative British-English spelling.
NSObject
finalize()
sessionData
If successfulklarnaFinalized()will be called in your listener. If not successfulklarnaFailed()will be called.
klarnaFinalized()
If you’d like to allow the user to review their payment after it’s authorized, this can be done in two ways:
loadPaymentReview()
This will load/replace the view’s content with a description of how your customer will have to perform payment
If successful klarnaLoadedPaymentReview()will be called in your listener. If not, klarnaFailed() it will be called instead.
klarnaLoadedPaymentReview()
This will handle all the errors from the previous implementations. KlarnaPaymentError will contain the information needed to show to the user and also to handle all the states of the listener.
error
name
message
isFatal
debugDescription
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Vincenzo Carrano
Administrator, Segshop
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.