Skip to content

Instantly share code, notes, and snippets.

View matiasgualino's full-sized avatar
🎯
Focusing

Matias Gualino matiasgualino

🎯
Focusing
View GitHub Profile
public void submit() {
// Armá un mapa con los datos de la compra y el mail de tu cliente.
Map preferenceMap = new HashMap<>();
preferenceMap.put("item_id", "1");
preferenceMap.put("amount", new BigDecimal(10));
preferenceMap.put("payer_email", "[email protected]");
// Envia la información a tu servidor
MerchantServer.createPreference(this, "http://merchantserver.com/",
import android.content.Intent;
import android.widget.Toast;
import android.widget.TextView;
import com.mercadopago.core.MercadoPago;
import com.mercadopago.model.ApiException;
import com.mercadopago.model.Payment;
// Espera los resultados del checkout
@Override
public void startCardFlowActivity(View view) {
// Llamar al activity propuesta por MP
new MercadoPago.StartActivityBuilder()
.setActivity(this)
.setPublicKey(TU_PUBLIC_KEY)
.setAmount(MONTO)
.startCardFlowActivity();
}
public void startCardFormActivity(View view) {
// Llamar al activity propuesta por MP
new MercadoPago.StartActivityBuilder()
.setActivity(this)
.setPublicKey(TU_PUBLIC_KEY)
.setAmount(MONTO)
.startCardFormActivity();
}
public void startIssuersActivity(View view) {
// Llamar al activity propuesta por MP
new MercadoPago.StartActivityBuilder()
.setActivity(this)
.setPublicKey(TU_PUBLIC_KEY)
.setPaymentMethod(mCurrentPaymentMethod)
.setAmount(MONTO)
.startCardIssuersActivity();
public class IssuersActivity extends Activity {
private String mMerchantPublicKey;
private String mPaymentMethodId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_issuers);
public class InstallmentsActivity extends Activity {
private String mMerchantPublicKey;
private String mPaymentMethodId;
private String mBin;
private BigDecimal mAmount;
private String mIssuerId;
@Override
protected void onCreate(Bundle savedInstanceState) {
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();
public class BankDealsActivity extends AppCompatActivity {
//Params
protected String mMerchantPublicKey;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bank_deals);
public void submit(View view) {
new MercadoPago.StartActivityBuilder()
.setActivity(this)
.setPublicKey(TU_PUBLIC_KEY)
.startBankDealsActivity();
}