简体   繁体   中英

Adding X-meli-session-id Header in MercadoPago SDK

My requirement is to add X-meli-session-id Header in the payment request to MercadoPago, but i cant find a way to add a extra header, I'm using mercadopago SKD "dx-java-1.0.33" and the request is done just calling

payment.save();

Anyone knows how to do that?

Thanks

I solved it. I updated the SDK to 1.2.1. This versions has an option to create a payment with an object "MPRequestOptions" in the constructor of save method as follow:

MPRequestOptions mpRequestOptions = MPRequestOptions.createDefault();
    customHeaders.put("X-meli-session-id",deviceId);
    mpRequestOptions.setCustomHeaders(customHeaders);

    payment.save(mpRequestOptions);

Regards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM