Skip to content

Instantly share code, notes, and snippets.

@matiasgualino
Last active April 26, 2016 00:45
Show Gist options
  • Save matiasgualino/369d5493d4fd8284de244ab73aa6f65a to your computer and use it in GitHub Desktop.
Save matiasgualino/369d5493d4fd8284de244ab73aa6f65a to your computer and use it in GitHub Desktop.
public void startInstallmentsActivity(View view) {
// Llamar al activity propuesta por MP
new MercadoPago.StartActivityBuilder()
.setActivity(this)
.setPublicKey(TU_PUBLIC_KEY)
.setPaymentMethod(mCurrentPaymentMethod)
.setIssuer(mCurrentIssuer)
.setAmount(MONTO)
.startCardInstallmentsActivity();
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == MercadoPago.CARD_INSTALLMENTS_REQUEST_CODE) {
if (resultCode == RESULT_OK && data != null) {
// Obtené las cuotas seleccionadas por el usuario
PayerCost payerCost = JsonUtil.getInstance()
.fromJson(data.getStringExtra("payerCost"), PayerCost.class);
// Ahora podes continuar con tu flujo.
} else {
if ((data != null) &&
(data.getSerializableExtra("apiException") != null)) {
ApiException apiException
= (ApiException) data.getSerializableExtra("apiException");
Toast.makeText(getApplicationContext(), apiException.getMessage(),
Toast.LENGTH_LONG).show();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment