Created
June 3, 2016 17:42
-
-
Save matiasgualino/e09e754941e1d8eca1781e34e4776c5c to your computer and use it in GitHub Desktop.
This file contains 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 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/", | |
"merchantUri/create_preference", preferenceMap, new Callback() { | |
@Override | |
public void success(CheckoutPreference checkoutPreference, | |
Response response) { | |
// La preferencia se creó correctamente. | |
// Aquí puedes iniciar el Checkout de MercadoPago. | |
new MercadoPago.StartActivityBuilder() | |
.setActivity(activity) | |
.setPublicKey(publicKey) | |
.setCheckoutPreferenceId(checkoutPreference.getId()) | |
.startCheckoutActivity(); | |
} | |
@Override | |
public void failure(RetrofitError error) { | |
// Ups, ocurrió un error | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment