Integration for Web (SDK)
Prerequisites
Before implementing Mercado Pago Wallet payments, ensure you have:
- Enabled Mercado Pago in the DEUNA Admin Panel.
- A generated order token.
- Integrated the DEUNA Web SDK in your project.
- Reviewed the Payment Widget documentation for Web.
Payment Widget Implementation
Display the payment widget by passing the Mercado Pago configuration in the paymentMethods parameter:
DeunaSDK.initPaymentWidget({
orderToken: 'YOUR_ORDER_TOKEN',
paymentMethods: [
{
paymentMethod: 'wallet',
processors: ['mercadopago_wallet'],
},
],
callbacks: {
onSuccess: async (order) => {
await DeunaSDK.close();
// Handle successful payment
console.log('Payment successful:', order);
},
onError: async (error) => {
// Handle payment errors
console.error('Payment error:', error);
if (...) {
await DeunaSDK.close();
// Handle UI updates
console.log('Payment widget closed due to error.');
}
},
},
});
Updated about 18 hours ago