# MD for: https://www.mercadopago.com.br/developers/es/docs/sdks-library/client-side/sdk-nativo.md \# Native SDK The Mercado Pago native SDK simplifies and secures the card payment process in Android and iOS applications. Select the technology you use and follow the steps to set up your development environment and start the payment flow securely. :::::TabsComponent ::::TabComponent{title="iOS"} Use the Mercado Pago native SDK to integrate payment methods into iOS applications. See below how to install and initialize the SDK. ### Install SDK Check below for the step-by-step instructions to install the SDK in your Swift project. 1\. In Swift Package Manager, click \*\*File > Add Packages\*\*. 2\. Paste the repository URL: \`https://github.com/mercadopago/sdk-ios\`. 3\. Select the desired SDK version. 4\. Click \*\*Add Package\*\* to complete the installation. ### Add dependencies Import the SDK dependencies into your project by running the following code: \`\`\` import CoreMethods \`\`\` ### Initialize SDK After installing the SDK and adding the dependencies to your project, initialize the SDK at the beginning of the application's lifecycle. This ensures that all essential settings are defined before any payment operation. > WARNING > > The SDK must be initialized only once when the application starts. To ensure correct operation, make a call to \`initialize()\` before using any other SDK functionality. To initialize the Mercado Pago library, you must use your :toolTipComponent\[credentials\]{link="/developers/en/docs/credentials" linkText="Credentials" content="Unique access keys that we use to identify an integration in your account, linked to your application. For more information, see the link below."}, which are unique keys that identify your integration and are linked to the :toolTipComponent\[application\]{link="/developers/en/docs/application-details" linkText="Application details" content="Entity registered in Mercado Pago that acts as an identifier for managing your integrations. For more information, see the link below."} you created, ensuring your project is developed with the best Mercado Pago security standards. At this stage, you should use your :toolTipComponent\[Production \_Public Key\_\]{content="Public key used in the \_frontend\_ to access information. You can access it through \*Your integrations > Application details > Production > Production credentials\*."}, which can be accessed in the \[details of your application\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-payments/more-resources/application-details) under \[Your integrations\](https://www.mercadopago.com.br/developers/panel/app), under the section \*\*Production > Production credentials\*\* in the menu on the left side of the screen. !\[Como acessar as credenciais através das Suas Integrações\](https://www.mercadopago.com.br/images/snippets/credentials-prod-panel-pt-v1.jpg) > NOTE > > If you are developing for someone else, you may access the credentials of applications you do not manage. See \[Share credentials\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-payments/resources/credentials#bookmark\_compartilhar\_credenciais) for more information. Copy the :toolTipComponent\[\_Public Key\_\]{content="Public key used in the \_frontend\_ to access information. You can access it through \*Your integrations > Application details > Production > Production credentials\*."} and include it in the code below. The initialization process varies depending on whether you use UIKit or SwiftUI. * [swiftui ](#editor%5F2) * [uikit ](#editor%5F1) uikit swiftui ``` import UIKit import CoreMethods @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { let configuration = MercadoPagoSDK.Configuration( publicKey: "YOUR-PUBLIC-KEY", country: // Enter the country of your public key ) MercadoPagoSDK.shared.initialize(configuration) return true } } ``` Copiar ``` import SwiftUI import CoreMethods @main struct YourApp: App { init() { let configuration = MercadoPagoSDK.Configuration( publicKey: "", country: "", locale: "en-US" ) MercadoPagoSDK.shared.initialize(configuration) } var body: some Scene { WindowGroup { ContentView() } } } ``` Copiar The initialization parameters are listed in the table below. | Parameter | Type | Description | Required | | ------------ | ------- | --------------------------------------------------------------------------------------------- | -------------- | | \`public\_key\` | String | Public key used in the \_frontend\_ to access information. You can access it through \*\*Your integrations > Application details > Production > Production credentials\*\*. | Required | | \`locale\` | String | Locale identifier (language and country). By default, the system's locale is used. | Optional | | \`country\` | \[Country\](https://mercadopago.github.io/sdk-ios/0.1.0/documentation/coremethods/mercadopagosdk/country) | \`Enum\` that identifies the country where the \_Core Methods\_ will be processed. Use the country code corresponding to your Public Key. See the \[documentation\](https://mercadopago.github.io/sdk-ios/0.1.0/documentation/coremethods/mercadopagosdk/country/) for your country's code. | Required | :::: ::::TabComponent{title="Android"} Use the Mercado Pago native SDK to integrate payment methods into Android applications. See below how to configure the repository and initialize the SDK. ### Configure repository Add the Mercado Pago repository to your project's \`settings.build.gradle\` file in Kotlin as shown below: \`\`\`kotlin pluginManagement { repositories { // Other dependencies... maven { url = uri("https://artifacts.mercadolibre.com/repository/android-releases") } } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL\_ON\_PROJECT\_REPOS) repositories { // Other dependencies... maven { url = uri("https://artifacts.mercadolibre.com/repository/android-releases") } } } \`\`\` ### Add dependencies Include the SDK dependencies in the \`build.gradle\` (or \`build.gradle.kts\`) file of your application's module: \`\`\`kotlin //Specify the SDK BOM with a version definition implementation(platform("com.mercadopago.android.sdk:sdk-android-bom:")) // Specify SDK library dependencies without a version definition implementation("com.mercadopago.android.sdk:core-methods") \`\`\` ### Initialize SDK After configuring the repository and adding the dependencies to your project, initialize the SDK at the beginning of the application's lifecycle. This ensures that all essential settings are defined before any payment operation. > WARNING > > The SDK must be initialized only once when the application starts. To ensure correct operation, make a call to \`initialize()\` before using any other SDK functionality. To initialize the Mercado Pago library, you must use your :toolTipComponent\[credentials\]{link="/developers/en/docs/credentials" linkText="Credentials" content="Unique access keys that we use to identify an integration in your account, linked to your application. For more information, see the link below."}, which are unique keys that identify your integration and are linked to the :toolTipComponent\[application\]{link="/developers/en/docs/application-details" linkText="Application details" content="Entity registered in Mercado Pago that acts as an identifier for managing your integrations. For more information, see the link below."} you created, ensuring your project is developed with the best Mercado Pago security standards. At this stage, you should use your :toolTipComponent\[Production \_Public Key\_\]{content="Public key used in the \_frontend\_ to access information. You can access it through \*Your integrations > Application details > Production > Production credentials\*."}, which can be accessed in the \[details of your application\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-payments/resources/application-details) under \[Your integrations\](https://www.mercadopago.com.br/developers/panel/app), under the section \*\*Production > Production credentials\*\* in the menu on the left side of the screen. !\[Como acessar as credenciais através das Suas Integrações\](https://www.mercadopago.com.br/images/snippets/credentials-prod-panel-pt-v1.jpg) > NOTE > > If you are developing for someone else, you may access the credentials of applications you do not manage. See \[Share credentials\](https://www.mercadopago.com.br/developers/en/docs/checkout-api-payments/resources/credentials#bookmark\_compartilhar\_credenciais) for more information. Copy the :toolTipComponent\[\_Public Key\_\]{content="Public key used in the \_frontend\_ to access information. You can access it through \*Your integrations > Application details > Production > Production credentials\*."} and include it in the code below. Then, initialize the SDK in the \`Application\` class, as in the following example: \`\`\`kotlin import android.app.Application import com.mercadopago.sdk.android.initializer.MercadoPagoSDK class MainApplication : Application() { override fun onCreate() { super.onCreate() MercadoPagoSDK.initialize( context = this, publicKey = "YOUR-PUBLIC-KEY", countryCode = "CountryCode of this public key" ) } } \`\`\` The initialization parameters are listed in the table below. | Parameter | Type | Description | Required | | ------------ | ------- | ------------------------------------------------------------------------------------------------- | -------------- | | \`context\` | \[Context\](https://developer.android.com/reference/android/content/Context) | Your application's context. | Required | | \`publicKey\` | String | Public key used in the \_frontend\_ to access information. You can access it through \*\*Your integrations > Application details > Production > Production credentials\*\*. | Required | | \`countryCode\`| \[CountryCode\](https://mercadopago.github.io/sdk-android/sdk-android/com.mercadopago.sdk.android.domain.model/-country-code/index.html?query=enum%20CountryCode%20:%20Enum%3CCountryCode%3E) | \`Enum\` that identifies the country where the \_Core Methods\_ will be processed. Use the country code corresponding to your Public Key. See the \[documentation\](https://mercadopago.github.io/sdk-ios/0.1.0/documentation/coremethods/mercadopagosdk/country/) for your country's code. | Required | :::: :::::