title: Android Studio: Transparent checkout using Mercado Pago
body: <p>I am trying to implement for the first time the Mercado Pago's transparent checkout in Android.</p>
  
  <p>I've already downloaded the newest version of the SDK provided in <a href="https://github.com/mercadopago/px-android" rel="nofollow noreferrer">https://github.com/mercadopago/px-android</a> and executed it normally in the Emulator.</p>
  
  <p>In the GitHub page mentioned above, we have an explanation of how to implement Mercado Pago's checkout with just one line of code:</p>
  
  <pre><code>new MercadoPagoCheckout.Builder("public_key", "checkout_preference_id")
      .build()
      .startPayment(activityOrContext, requestCode);
  </code></pre>
  
  <p>Where <code>public_key</code> we can get in the credentials webpage. But the <strong>String</strong> <code>checkout_preference_id</code> I have no idea of how to create it, even though they showed how to create it at the end of the GitHub webpage.</p>
  
  <p><strong>Create your preference id</strong></p>
  
  <pre><code>curl -X POST \
       'https://api.mercadopago.com/checkout/preferences?access_token=ACCESS_TOKEN' \
       -H 'Content-Type: application/json' \
       -d '{
             "items": [
                 {
                 "title": "Dummy Item",
                 "description": "Multicolor Item",
                 "quantity": 1,
                 "currency_id": "ARS",
                 "unit_price": 10.0
                 }
             ],
             "payer": {
                 "email": "payer@email.com"
             }
       }'
  </code></pre>
  
  <p>I tried to put a random <strong>String</strong> in <code>checkout_preference_id</code>, but it did not work. Only the <strong>String</strong> in the example app of Mercado Pago worked.</p>
  
  <pre><code>private static final String DUMMY_PREFERENCE_ID = "243962506-0bb62e22-5c7b-425e-a0a6-c22d0f4758a9";
  </code></pre>
  
  <p>All the other ways of implementing it presented in the example app of Mercado Pago require a fake confirmation of payment.</p>
  
  <p>I appreciate if anyone could show some code of how to create and pass the variable <code>checkout_preference_id</code> into the main command of Mercado Pago payment.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I also appreciate if anyone could give us an example of a <strong>Not fake</strong> confirmation of payment with some code.</p>
  
  <p>I guess <code>checkout_preference_id</code> can be accessed via a Marketplace website or maybe creating a <code>curl</code> using Android's webservice. Then, it is still a mystery to me.</p>
  
  <p>Concerning to the alternitive way of paying with MercadoPago, we have this other arguments to pass:</p>
  
  <pre><code>new MercadoPagoCheckout.Builder("public_key", checkoutPreference, paymentConfiguration)
                  .build()
                  .startPayment(activityOrContext, requestCode);
  </code></pre>
  
  <p>Where <code>checkoutPreference</code> allows you to create a <strong>custom item</strong> to sell.</p>
  
  <pre><code>final Item item = new Item.Builder("Product Title", 1, new BigDecimal(12.3)).setDescription("Product Description").build();
  CheckoutPreference checkoutPreference = new CheckoutPreference.Builder(Sites.BRASIL, "a@a.a", Collections.singletonList(item)).setDefaultInstallments(1).build();
  </code></pre>
  
  <p><code>paymentConfiguration</code> is implemented <strong>the fake confirmation of payment</strong>.</p>
  
  <pre><code>PaymentConfiguration paymentConfiguration = new PaymentConfiguration.Builder(new MyPaymentProcessor()).build();
  </code></pre>
  
  <p>Where the class <code>MyPaymentProcessor()</code> and the other classes in which it depends on can be found in the GitHub example.</p>