# Possible to get merchantId from .config in code

**URL:** <https://forum.litium.com/t/possible-to-get-merchantid-from-config-in-code/758>\
**Category:** Questions\
**Tags:** litium-6, accelerator\
**Created:** [March 26, 2019, 2:04pm UTC](https://forum.litium.com/t/possible-to-get-merchantid-from-config-in-code/758 "2019-03-26T14:04:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cissi](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/cissi/32/18_2.png) [@Cissi](https://forum.litium.com/u/Cissi)\
**Post date:** [March 26, 2019, 2:04pm UTC](https://forum.litium.com/t/possible-to-get-merchantid-from-config-in-code/758/1 "2019-03-26T14:04:05Z")

</div>

Can i get the merchantid from a paymentmethods config file?

Litium version: 6.2

---

<div class="post-metadata">

**Author:** ![MartinBrandt](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MartinBrandt](https://forum.litium.com/u/MartinBrandt)\
**Post date:** [March 27, 2019, 7:58am UTC](https://forum.litium.com/t/possible-to-get-merchantid-from-config-in-code/758/2 "2019-03-27T07:58:25Z")

</div>

I dont know about 6.x but in older versions if you access the payment provider, they have a public method called GetPaymentAccount(paymentMethod) that will give you an object that contains this info.

This is some code from a custom payment provider (Goyada) I have written, but I can see the same method available as public static in Klarna addon for example (although an older version):

var paymentAccount = myProvider.GetPaymentAccount(orderRowInfo[1]);  
var merchantId = paymentAccount.MerchantId

and you should be able to access the provider from order payment info… or paymentmethod.provider etc etc… it should be available somewhere 😉

---

<div class="post-metadata">

**Author:** ![Cissi](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/cissi/32/18_2.png) [@Cissi](https://forum.litium.com/u/Cissi)\
**Post date:** [April 11, 2019, 9:18am UTC](https://forum.litium.com/t/possible-to-get-merchantid-from-config-in-code/758/3 "2019-04-11T09:18:55Z")

</div>

Did it thanks to Martin, hade to rewrite the payment api so I could use merchantid 😉
