Using CocoaPods
Edit your Podfile
and specify the dependency:
pod 'MercadoPagoSDK'
- Easy to install
- Easy to integrate
- PCI compliance
- Font customization
- Basic color customization
- Advanced color customization
- Lazy loading initialization support
- Custom UIViews support in certain screens
- Support to build your own Payment Processor
- Support to create your own custom Payment Method
Only 3 steps needed to create a basic checkout using MercadopagoSDK
:
import MercadoPagoSDK
let checkout = MercadoPagoCheckout.init(builder: MercadoPagoCheckoutBuilder.init(publicKey: "your_public_key", preferenceId: "your_checkout_preference_id"))
checkout.start(navigationController: self.navigationController!)
MercadoPagoCheckout.init(builder: MercadoPagoCheckoutBuilder.init(publicKey: "your_public_key", preferenceId: "your_checkout_preference_id")).start(navigationController: self.navigationController!)
Check our official code reference , especially MercadoPagoCheckoutBuilder object to explore all available functionalities.
You can define one color (your main color) and we will take care of the rest. Delivering the best Checkout experience based on your color.
checkoutBuilder.setColor(checkoutColor: UIColor.purple)
If you need an advanced color customization, you can customize your colors through our PXTheme
interface/protocol. Check the PXTheme
methods in our reference guide.
The following example implements the protocol PXTheme
to customize the UI with Mercadolibre style:
final class ExampleTheme: PXTheme {
let primaryColor: UIColor = #colorLiteral(red: 1, green: 0.9176470588, blue: 0.4705882353, alpha: 1)
public func navigationBar() -> PXThemeProperty {
return PXThemeProperty(backgroundColor: primaryColor, tintColor: #colorLiteral(red: 0.2, green: 0.2, blue: 0.2, alpha: 1))
}
public func loadingComponent() -> PXThemeProperty {
return PXThemeProperty(backgroundColor: primaryColor, tintColor: #colorLiteral(red: 0.2039215686, green: 0.5137254902, blue: 0.9803921569, alpha: 1))
}
public func highlightBackgroundColor() -> UIColor {
return primaryColor
}
public func detailedBackgroundColor() -> UIColor {
return #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
}
public func statusBarStyle() -> UIStatusBarStyle {
return .default
}
}
You can set your custom Font by PXTheme
protocol. Implement the following 3 optional methods:
@objc optional func fontName() -> String?
@objc optional func lightFontName() -> String?
@objc optional func semiBoldFontName() -> String?
We provide PXTrackerListener
protocol to notify each tracking event. You can subscribe to this protocol using PXTracker
.
@objc public protocol PXTrackerListener: NSObjectProtocol {
func trackScreen(screenName: String, extraParams: [String: Any]?)
func trackEvent(screenName: String?, action: String!, result: String?, extraParams: [String: Any]?)
}
PXTracker.setListener(self)
- iOS 9.0+
- Swift 4.2
- xCode 9.2+
- @Objc full compatibility
This project include an example project using MercadoPagoSDKV4. ExampleObjectiveC & ExampleSwift
. In case you need support contact the MercadoPago Developers Site.
You can join the MercadoPago Developers Community on MercadoPago Developers Site:
This is an open source project, so feel free to contribute. How?
- Fork this project and propose your own fixes, suggestions and open a pull request with the changes.
Mercado Pago / Mercado Libre
MIT License
Copyright (c) 2018 - Mercado Pago / Mercado Libre
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.