This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class InstructionsActivity extends AppCompatActivity { | |
| //Params | |
| protected Payment mPayment; | |
| protected String mMerchantPublicKey; | |
| protected PaymentMethod mPaymentMethod; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void createPayment(final Activity activity, String token, | |
| Integer installments, Long cardIssuerId, final PaymentMethod paymentMethod) { | |
| if (paymentMethod != null) { | |
| // Crear el item que se está cobrando | |
| Item item = new Item(DUMMY_ITEM_ID, DUMMY_ITEM_QUANTITY, | |
| DUMMY_ITEM_UNIT_PRICE); | |
| // Obtener el ID del medio de pago |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void startInstructionsActivity(Payment payment, PaymentMethod paymentMethod) { | |
| new MercadoPago.StartActivityBuilder() | |
| .setPublicKey(TU_PUBLIC_KEY) | |
| .setActivity(this) | |
| .setPayment(payment) | |
| .setPaymentMethod(paymentMethod) | |
| .startInstructionsActivity(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PaymentMethodsActivity extends Activity { | |
| private String mMerchantPublicKey; | |
| private String mPaymentTypeSupported; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_payment_methods); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Button onClick method | |
| public void startPaymentMethodsActivity(View view) { | |
| // Decinos qué tipos de pagos soportas. | |
| protected List<string> mSupportedPaymentTypes = new ArrayList<string>(){{ | |
| add("credit_card"); | |
| add("debit_card"); | |
| add("prepaid_card"); | |
| add("ticket"); | |
| add("atm"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Button onClick method | |
| public void submit(View view) { | |
| /* | |
| 1. Crea la lista de medios a excluir | |
| Como pudiste ver en un paso anterior, transferencia bancaria | |
| tenía 3 medios de pagos disponibles. Vamos a ver que pasa si | |
| excluímos dos de ellos.. | |
| */ | |
| List<String> excludedPaymentMethodIds = new ArrayList<String>(){{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Button onClick method | |
| public void submit(View view) { | |
| // 1. Crea la lista de tipos a excluir | |
| List<String> excludedPaymenTypesIds = new ArrayList<String>(){{ | |
| add(PaymentType.BANK_TRANSFER); | |
| }}; | |
| // 2. Inicia la UI de MercadoPago seteando la lista de exclusiones | |
| new MercadoPago.StartActivityBuilder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Button onClick method | |
| public void submit(View view) { | |
| // Start MercadoPago PaymentVault activity | |
| new MercadoPago.StartActivityBuilder() | |
| .setActivity(activity) | |
| .setPublicKey(PUBLIC_KEY) | |
| .setAmount(BigDecimal.valueOf(MONTO)) | |
| .setPurchaseTitle(NOMBRE_PRODUCTO) | |
| .startPaymentVaultActivity(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:paddingLeft="@dimen/activity_horizontal_margin" | |
| android:paddingRight="@dimen/activity_horizontal_margin" | |
| android:paddingTop="@dimen/activity_vertical_margin" | |
| android:paddingBottom="@dimen/activity_vertical_margin" | |
| android:orientation="vertical" | |
| tools:context=".MainActivity"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.view.View; | |
| import com.mercadopago.core.MercadoPago; | |
| // Método ejecutado al hacer clic en el botón | |
| public void submit(View view) { | |
| // Obtener ID de la preferencia (Paso 3) | |
| // Iniciar el checkout de MercadoPago |