# MD for: https://www.mercadopago.com.ar/developers/es/docs/checkout-api-orders/payment-integration/mobile/payment.md \# Payment \*\*Payment\*\*, part of Mercado Pago SDK Checkout, provides a payment method selector and processes orders in native Android and iOS applications. Buyers can use a saved card, enter a new card or generate Rapipago and Pago Fácil instructions, according to the order rules. Your backend creates the order and confirms the financial status of the purchase. The SDK manages the selected method steps, including CVV, card form, installments, review and results when applicable. The card token used for processing remains inside the SDK. ## Prepare the integration Configure SDK Checkout in the \[development environment\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-orders/development-environment). Use a supported release and keep Checkout and Core Methods on the same version. Obtain application test credentials in \[Your integrations\](https://www.mercadopago.com.ar/developers/en/docs/your-integrations/credentials). - \*\*Android:\*\* enable Compose. Use the SDK BoM to align modules. The SDK requires Android 6.0 or later (\`minSdk 23\`) and Kotlin 2.0 or later. - \*\*iOS:\*\* add the \`MercadoPagoCheckout\` product through Swift Package Manager. The package declares iOS 13 as its minimum platform and Swift tools 6.0; use an Xcode version compatible with your chosen release. Initialize the application with the :toolTipComponent\[Public Key\]{content="Public credential that identifies the application in the SDK." link="/developers/en/docs/your-integrations/credentials"}. Keep the :toolTipComponent\[Access Token\]{content="Private credential used by your backend. Never include it in the mobile application." link="/developers/en/docs/your-integrations/credentials"} only in your backend. Use credentials from the same application and environment. The examples were checked against \[Android 1.0.4\](https://github.com/mercadopago/sdk-android/releases/tag/v.1.0.4) and \[iOS 1.3.0\](https://github.com/mercadopago/sdk-ios/releases/tag/1.3.0), which include Payment, review and Status Screen. These are verified versions for this guide; they do not establish the first release to include each feature. ## Initialize the SDK Initialize once at application startup, before opening checkout. Do not repeat initialization for every payment attempt. :::::TabsComponent ::::TabComponent{title="Android"} kotlin kotlin ``` import android.app.Application import com.mercadopago.sdk.android.domain.model.CountryCode import com.mercadopago.sdk.android.initializer.MercadoPagoSDK class MyApplication : Application() { override fun onCreate() { super.onCreate() MercadoPagoSDK.initialize( context = this, publicKey = "YOUR_TEST_PUBLIC_KEY", countryCode = CountryCode.ARG, ) } } ``` Register \`MyApplication\` as your manifest \`Application\` class. :::: ::::TabComponent{title="iOS"} swift swift ``` import CoreMethods import UIKit final class AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { let configuration = MercadoPagoSDK.Configuration( publicKey: "YOUR_TEST_PUBLIC_KEY", country: .ARG ) MercadoPagoSDK.shared.initialize(configuration) return true } } ``` For SwiftUI, run the same initialization at the application entry point. Build and present checkout on \`MainActor\`. :::: ::::: ## Create the order in your backend Create an online order through :TagComponent{tag="POST" text="/v1/orders" href="/developers/en/reference/online-payments/checkout-api/create-order/post" color="green"} in manual mode (\`processing\_mode: "manual"\`). Do not send a card or token transaction at this point: the SDK collects the selected method and completes processing. The amount, payer and payment rules belong to the order. curl curl ``` curl --request POST 'https://api.mercadopago.com/v1/orders' \ --header "Authorization: Bearer $MP_ACCESS_TOKEN" \ --header "X-Idempotency-Key: $MP_IDEMPOTENCY_KEY" \ --header 'Content-Type: application/json' \ --data '{ "type": "online", "processing_mode": "manual", "total_amount": "100.00", "external_reference": "purchase-1234", "payer": { "email": "test_payer@example.com" }, "items": [ { "title": "Product", "quantity": 1, "unit_price": "100.00" } ] }' ``` Define \`MP\_ACCESS\_TOKEN\` only in your backend. Generate \`MP\_IDEMPOTENCY\_KEY\` for the logical order creation. Replace illustrative data with your purchase and test-payer data; add the fields required by the Orders contract for your scenario. The response provides \`id\` and \`client\_token\`: send them to the application as the \`orderId\` and \`clientToken\` of \`MPOrder\`. Do not log \`clientToken\`. ## Integrate by platform :::::TabsComponent ::::TabComponent{title="Android"} :::AccordionComponent{title="Configure and display Payment" pill="client-side"} Use the order received from your backend. \`openPaymentCheckout\` is an application-defined helper in this example, not an SDK method. \`show\` opens the SDK Activity and can be triggered from Compose or Views; it does not return a View to embed in Compose. kotlin kotlin ``` import android.app.Activity import com.mercadopago.sdk.android.checkout.core.MercadoPagoCheckout import com.mercadopago.sdk.android.checkout.core.model.* import com.mercadopago.sdk.android.checkout.domain.callback.MercadoPagoCheckoutResult fun openPaymentCheckout(activity: Activity, order: MPOrder) { val checkout = MercadoPagoCheckout.Builder( context = activity, checkoutType = MPCheckoutType.Payment( order = order, sellerInfo = MPSellerInfo( name = "My Store", logoUrl = "https://example.com/logo.png", ), ), ).build() checkout.show { result -> when (result) { is MercadoPagoCheckoutResult.Success -> { val payment = result.paymentData // Reconcile payment.orderId in your backend. } is MercadoPagoCheckoutResult.Error -> { // Handle the failure in your application. } is MercadoPagoCheckoutResult.UserCancelled -> { val screens = result.cancelledData.screens // Return to the cart. } } } } ``` | Field | Type | Description | Example | Required | | --- | --- | --- | --- | --- | | \`context\` | \`Context\` | Context of the Activity that opens checkout. | \`activity\` | Yes | | \`checkoutType\` | \`MPCheckoutType.Payment\` | Selects the Payment flow. | \`Payment\` | Yes | | \`order\` | \`MPOrder\` | ID and token of the order created in the backend. | \`orderId\`, \`clientToken\` | Yes | | \`sellerInfo\` | \`MPSellerInfo?\` | Name and logo displayed in review and results. | \`name\`, \`logoUrl\` | No | | \`checkoutAppearance\` | \`MPCheckoutAppearance?\` | Checkout appearance. | \`MPCheckoutAppearance()\` | No | The backend retrieves saved cards using \`payer.customer\_id\`; without this identifier, it may also locate the customer by email. CVV and installments are displayed according to returned data; inapplicable steps are skipped. Credit, debit and prepaid availability depends on order rules. A new card is not automatically saved for future purchases. ::: :::AccordionComponent{title="Handle the result" pill="client-side"} The success result is \`MPPaymentData.Payment\`. It does not contain \`transactionAmount\`, a card token, payment code, receipt URL or expiration date. Query the order in your backend to obtain these details outside the Status Screen. | Field | Type | Description | Example | Required | | --- | --- | --- | --- | --- | | \`orderId\` | \`String\` | Processed order ID. | \`ORDER\_ID\` | Yes | | \`orderStatus\` | \`String\` | Status after processing; it does not establish approval on its own. | \`action\_required\` | Yes | | \`paymentMethodId\` | \`String\` | Payment method used. | \`visa\`, \`rapipago\` | Yes | | \`paymentTypeId\` | \`String\` | Payment method type. | \`credit\_card\`, \`debit\_card\`, \`prepaid\_card\`, \`ticket\` | Yes | | \`orderStatusDetail\` | \`String?\` | Optional status detail. | \`waiting\_payment\` | No | A success callback does not by itself confirm payment approval. After Rapipago or Pago Fácil instructions are generated, the order may remain in \`action\_required\` / \`waiting\_payment\`: the buyer still needs to pay. A card may also return a pending result under review or processing. Confirm the financial status in your backend before fulfilling the purchase. \`Error\` reports a flow failure. \`UserCancelled\` returns \`MPUserCancelledContext.Payment\` with the \`screens\` history. Status Screen closure is reported by \`onExit\`, separately from the processing result. ::: :::AccordionComponent{title="Review the purchase before charging" pill="client-side"} Review is optional and disabled by default. Enable \`withReviewAndConfirm\` before \`build\`. The screen displays the backend summary and processes the order after buyer confirmation. The buyer can change the payment method before confirming. Returning to the preceding step does not by itself cancel the entire checkout. \*\*Change the email for offline payments\*\* For offline payments, review may show a masked email. Provide \`onEmailChangeRequested\` to enable changes. The SDK closes checkout and invokes this callback without reporting cancellation. Your application collects the new email, creates another order in the backend and builds a new checkout instance. The SDK does not modify the order email in memory. Without this callback, the email is read-only. kotlin kotlin ``` import com.mercadopago.sdk.android.checkout.core.extensions.withReviewAndConfirm val checkout = MercadoPagoCheckout.Builder( context = activity, checkoutType = MPCheckoutType.Payment(order = order), ) .withReviewAndConfirm() .build() val checkoutWithEmailChange = MercadoPagoCheckout.Builder( context = activity, checkoutType = MPCheckoutType.Payment(order = order), ) .withReviewAndConfirm(onEmailChangeRequested = { // Collect the email, create another order and reopen checkout. }) .build() ``` In the additional snippets, \`activity\` and \`order\` are values from your application. \*\*Handle loading failures\*\* If review fails to load, the buyer may return to the preceding step with feedback, without checkout ending through the error callback. Do not interpret this navigation as payment confirmation. ::: :::AccordionComponent{title="Display the payment result" pill="client-side"} Status Screen is optional and disabled by default. Enable \`withStatusScreen\`, with the required \`onExit\` callback, to display results within checkout. It works with or without review; to omit review from the example, remove only \`withReviewAndConfirm\`. kotlin kotlin ``` import com.mercadopago.sdk.android.checkout.core.extensions.withReviewAndConfirm import com.mercadopago.sdk.android.checkout.core.extensions.withStatusScreen val checkout = MercadoPagoCheckout.Builder( context = activity, checkoutType = MPCheckoutType.Payment( order = order, sellerInfo = MPSellerInfo(name = "My Store"), ), ) .withReviewAndConfirm() .withStatusScreen(onExit = { // Resume your application and reconcile the order in your backend. }) .build() checkout.show { result -> when (result) { is MercadoPagoCheckoutResult.Success -> { val payment = result.paymentData // Preserve payment; keep checkout open for the status screen. } is MercadoPagoCheckoutResult.Error -> { // Handle the failure; do not close the status screen here. } is MercadoPagoCheckoutResult.UserCancelled -> { val screens = result.cancelledData.screens // Return to the cart. } } } ``` The processing result may arrive before Status Screen is displayed. Keep checkout open when success or error arrives if that screen still needs to appear. \`onExit\` reports closure and carries neither order data nor approval. There is no \`Exit\` result. Initialization errors, validation errors and cancellations may end the flow before this screen; do not rely exclusively on \`onExit\` to reconcile every attempt. | Presentation | Content and expected action | | --- | --- | | Approved | Approval feedback, store details, summary and receipt when returned. The approval presentation differs from the success callback. | | Pending | Manual review, contingency or processing. It may show guidance and a back action; a barcode is not required and retry is not offered. | | Offline instructions | Payment code, copy action, expiration and document when available. Generating instructions does not establish approval. | | Rejection or failure | Error title, payment method summary, operation number and guidance when available. It may offer changing the payment method when the order permits retry; a store row is not guaranteed. | If the Status Screen query fails, the SDK may display fallback content from processing data, or a generic error if data is missing. This presentation does not guarantee all details and actions from the original response. Preserve the result and query the order in your backend. \*\*Receipt and privacy\*\* When available, the receipt is downloaded and shared through Android native sharing. The SDK already declares the \`FileProvider\` with authority \`${applicationId}.mercadopago.checkout.fileprovider\`; do not declare another with the same authority. Downloads accept PDFs up to 5 MiB, without following redirects. If download or sharing fails, the SDK attempts to open the original URL in an external application; this path is not subject to the local download 5 MiB limit. Receipts are cached. Files older than 24 hours are removed when cleanup runs again upon entering Status Screen or starting another download; deletion is not scheduled for exactly 24 hours. Screenshot blocking applies to the loaded screen, without a guarantee for every fallback state. Remote URLs undergo HTTPS filtering and blocking of known literal local or private hosts; this is not DNS validation of a public destination. Barcode images may also use \`data:image/png;base64\`. Displayed card data is limited to the last four digits. ::: :::AccordionComponent{title="Allow another payment attempt" pill="client-side"} To check eligibility, query the order in your backend: the documented combination is \`status: action\_required\` and \`status\_detail: waiting\_retry\`. \`waiting\_retry\` is not a \`status\` value. Authorize attempts with \`config.online.retries.allowed: true\`. Changing the method on Status Screen depends on the server returning the \`change\_payment\_method\` action; the flag and order state alone do not guarantee that the button appears. \`can\_retry\` belongs to the Status Screen response, not the order creation body. When the action is offered, the buyer returns to the selector for another attempt with the same order. Reconcile all results by \`orderId\`. The pending presentation does not offer retry. Configure backend authorization as described in \[Behavior and support\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-orders/additional-settings/mobile/payment-behavior-customizations). To reopen the experience from your application, build another instance with \`Builder\` and reconcile the order before deciding whether to create a new purchase. ::: :::: ::::TabComponent{title="iOS"} :::AccordionComponent{title="Configure and display Payment" pill="client-side"} Use the order received from your backend. \`openPaymentCheckout\` is an application-defined helper in this example, not an SDK method. \`present(from:animated:onResult:)\` opens a full-screen presentation. Use \`push(to:animated:onResult:)\` for a \`UINavigationController\`. \`checkoutAppearance\` is required; \`.init()\` selects the default appearance. swift swift ``` import MercadoPagoCheckout import UIKit @MainActor func openPaymentCheckout(from viewController: UIViewController, order: MPOrder) { let checkout = MercadoPagoCheckout.Builder( checkoutType: .payment( order: order, sellerInfo: MPSellerInfo( name: "My Store", logoUrl: "https://example.com/logo.png" ) ), checkoutAppearance: .init() ).build() checkout.present(from: viewController) { result in switch result { case let .success(payment): // Reconcile payment.orderId in your backend. _ = payment.orderId case let .error(error): // Handle the failure in your application. _ = error case let .userCancelled(context): // Return to the cart. _ = context.screens } } } ``` | Field | Type | Description | Example | Required | | --- | --- | --- | --- | --- | | \`checkoutType\` | \`.payment(order:sellerInfo:)\` | Selects the Payment flow. | \`.payment\` | Yes | | \`order\` | \`MPOrder\` | ID and token of the order created in the backend. | \`orderId\`, \`clientToken\` | Yes | | \`sellerInfo\` | \`MPSellerInfo?\` | Name and logo displayed in review and results. | \`name\`, \`logoUrl\` | No | | \`checkoutAppearance\` | \`MPCheckoutAppearance\` | Checkout appearance. | \`.init()\` | Yes | The backend retrieves saved cards using \`payer.customer\_id\`; without this identifier, it may also locate the customer by email. CVV and installments are displayed according to returned data; inapplicable steps are skipped. Credit, debit and prepaid availability depends on order rules. A new card is not automatically saved for future purchases. \*\*SwiftUI\*\* swift swift ``` import SwiftUI import MercadoPagoCheckout @MainActor struct PaymentView: View { let checkout: MercadoPagoCheckout var body: some View { checkout.show { result in switch result { case let .success(payment): _ = payment.orderId case let .error(error): _ = error case let .userCancelled(context): _ = context.screens } } } } ``` \`PaymentView\` is an application-defined View. Include the View returned by \`checkout.show(onResult:)\` in your presented hierarchy, for example in \`sheet\` or \`fullScreenCover\`; calling \`show\` alone does not present a screen. Build and retain the instance before presenting it, rather than recreating it on every \`body\` evaluation. ::: :::AccordionComponent{title="Handle the result" pill="client-side"} The success result is \`MPPaymentData.Payment\`. It does not contain \`transactionAmount\`, a card token, payment code, receipt URL or expiration date. Query the order in your backend to obtain these details outside the Status Screen. | Field | Type | Description | Example | Required | | --- | --- | --- | --- | --- | | \`orderId\` | \`String\` | Processed order ID. | \`ORDER\_ID\` | Yes | | \`orderStatus\` | \`String\` | Status after processing; it does not establish approval on its own. | \`action\_required\` | Yes | | \`paymentMethodId\` | \`String\` | Payment method used. | \`visa\`, \`rapipago\` | Yes | | \`paymentTypeId\` | \`String\` | Payment method type. | \`credit\_card\`, \`debit\_card\`, \`prepaid\_card\`, \`ticket\` | Yes | | \`orderStatusDetail\` | \`String?\` | Optional status detail. | \`waiting\_payment\` | No | A success callback does not by itself confirm payment approval. After Rapipago or Pago Fácil instructions are generated, the order may remain in \`action\_required\` / \`waiting\_payment\`: the buyer still needs to pay. A card may also return a pending result under review or processing. Confirm the financial status in your backend before fulfilling the purchase. \`.error\` reports a flow failure. \`.userCancelled\` returns \`MPUserCancelledContext.Payment\` with the \`screens\` history. Status Screen closure is reported by \`onExit\`, separately from the processing result. ::: :::AccordionComponent{title="Review the purchase before charging" pill="client-side"} Review is optional and disabled by default. Enable \`withReviewAndConfirm\` before \`build\`. The screen displays the backend summary and processes the order after buyer confirmation. The buyer can change the payment method before confirming. Returning to the preceding step does not by itself cancel the entire checkout. \*\*Change the email for offline payments\*\* For offline payments, review may show a masked email. Provide \`onEmailChangeRequested\` to enable changes. The SDK closes checkout and invokes this callback without reporting cancellation. Your application collects the new email, creates another order in the backend and builds a new checkout instance. The SDK does not modify the order email in memory. Without this callback, the email is read-only. swift swift ``` @MainActor func makeReviewCheckout(order: MPOrder) -> MercadoPagoCheckout { MercadoPagoCheckout.Builder( checkoutType: .payment(order: order), checkoutAppearance: .init() ) .withReviewAndConfirm() .build() } // Optional email-change action for offline payments. let checkoutWithEmailChange = MercadoPagoCheckout.Builder( checkoutType: .payment(order: order), checkoutAppearance: .init() ) .withReviewAndConfirm(onEmailChangeRequested: { // Collect the email, create another order and reopen checkout. }) .build() ``` Run the snippets on \`MainActor\`, with \`order\` received from your backend. \`makeReviewCheckout\` is an application helper used only in the example. \*\*Handle loading failures\*\* If review fails to load, the buyer may return to the preceding step with feedback, without checkout ending through the error callback. Do not interpret this navigation as payment confirmation. ::: :::AccordionComponent{title="Display the payment result" pill="client-side"} Status Screen is optional and disabled by default. Enable \`withStatusScreen\`, with the required \`onExit\` callback, to display results within checkout. It works with or without review; to omit review from the example, remove only \`withReviewAndConfirm\`. swift swift ``` @MainActor func makePaymentCheckout(order: MPOrder) -> MercadoPagoCheckout { MercadoPagoCheckout.Builder( checkoutType: .payment( order: order, sellerInfo: MPSellerInfo(name: "My Store") ), checkoutAppearance: .init() ) .withReviewAndConfirm() .withStatusScreen(onExit: { // Resume your application and reconcile the order in your backend. }) .build() } ``` The processing result may arrive before Status Screen is displayed. Keep checkout open when success or error arrives if that screen still needs to appear. \`onExit\` reports closure and carries neither order data nor approval. There is no \`Exit\` result. Initialization errors, validation errors and cancellations may end the flow before this screen; do not rely exclusively on \`onExit\` to reconcile every attempt. | Presentation | Content and expected action | | --- | --- | | Approved | Approval feedback, store details, summary and receipt when returned. The approval presentation differs from the success callback. | | Pending | Manual review, contingency or processing. It may show guidance and a back action; a barcode is not required and retry is not offered. | | Offline instructions | Payment code, copy action, expiration and document when available. Generating instructions does not establish approval. | | Rejection or failure | Error title, payment method summary, operation number and guidance when available. It may offer changing the payment method when the order permits retry; a store row is not guaranteed. | \`makePaymentCheckout\` is an application helper. Present the instance with UIKit or SwiftUI as shown in the first step. Keep the presentation open when receiving the processing result so Status Screen can appear. In the default presentation, the SDK closes checkout. Use \`onExit\` to resume the application flow and query the order in your backend. If the query fails, the SDK attempts to build fallback content from the result in memory; processing failures may use a generic error. If no usable fallback exists, the screen closes without calling \`onExit\`. Preserve the result and reconcile the order in your backend. \*\*Receipt and privacy\*\* The SDK downloads receipt URLs ending in \`.pdf\`; other URLs are loaded through WebKit and converted to PDF. Downloads allow up to 10 MiB and conversion limits output to 20 pages. These flows reject redirects and use a 15-second loading timeout. The temporary file uses complete file protection and is removed when sharing completes or is dismissed. Android’s 24-hour cache rule does not apply. If preparation fails, the buyer remains on the screen; the original URL is not opened externally as a fallback. The iOS Status Screen does not guarantee screenshot or screen-recording blocking, or hiding content in recent applications. It does not apply Android’s HTTPS host filter. Do not assume DNS validation or a public-destination guarantee for content URLs returned by the backend. ::: :::AccordionComponent{title="Allow another payment attempt" pill="client-side"} To check eligibility, query the order in your backend: the documented combination is \`status: action\_required\` and \`status\_detail: waiting\_retry\`. \`waiting\_retry\` is not a \`status\` value. Authorize attempts with \`config.online.retries.allowed: true\`. Changing the method on Status Screen depends on the server returning the \`change\_payment\_method\` action; the flag and order state alone do not guarantee that the button appears. \`can\_retry\` belongs to the Status Screen response, not the order creation body. When the action is offered, the buyer returns to the selector for another attempt with the same order. Reconcile all results by \`orderId\`. The pending presentation does not offer retry. Configure backend authorization as described in \[Behavior and support\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-orders/additional-settings/mobile/payment-behavior-customizations). To reopen the experience from your application, build another instance with \`Builder\` and reconcile the order before deciding whether to create a new purchase. ::: :::: ::::: ## Confirm payment in your backend Query the order in your backend and configure \[notifications\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-orders/notifications) to track later changes. If the response or connection is lost, reconcile the same order before starting another charge. Neither the SDK response nor screen closure authorizes fulfillment. Continue to \[Visual customizations\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-orders/additional-settings/mobile/payment-visual-customizations) and \[Behavior and support\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-orders/additional-settings/mobile/payment-behavior-customizations) to configure appearance, order rules and tests.