Waqas Saeed Posted March 12, 2021 Share Posted March 12, 2021 (edited) Hello. Hook file contain this code,. to retrieve the values from the database, With latest version of WHMCS 8 am unable to access the variable through the following code; $invoiceData['merchant_id'] = Capsule::table('tblpaymentgateways')->where('gateway', 'MODULE')->where('setting' , 'ppmerchantId')->get(); if echo $invoiceData['merchant_id'] returns; [{"id":58,"gateway":"MODULE","setting":"ppmerchantId","value":"7247821a8601xxxxxxf862bc00d51df36f8b7f4c7cbc503fdf06e54cc41d09798d3a74513ff8d6ac8c","order":0}] How to retrieve the value in PHP code? Version : Most Latest WHMCS. PHP 7.4 Edited March 12, 2021 by Waqas Saeed 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 12, 2021 Share Posted March 12, 2021 (edited) 4 hours ago, Waqas Saeed said: How to retrieve the value in PHP code? Not sure I understand the question. You have the value in that object you mention and you just need to access it like other objects -- via "->property_name". So in this case, you would use $invoiceData['merchant_id']->value or am i missing something? Another option is using: $Value = Capsule::table('tblpaymentgateways')->where('gateway','gateway-name')->where('setting','setting_name')->first()->value; Edited March 12, 2021 by steven99 0 Quote Link to comment Share on other sites More sharing options...
Waqas Saeed Posted March 12, 2021 Author Share Posted March 12, 2021 @steven99 if I echo this, it returns something like that Quote 7247821a8601be96a191a93b3d31989df862bc00d51df36f8b7f4c7cbc503fdf06e54cc41d09798d3a74513ff8d6ac8c I need the value here, the actual from the database. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 12, 2021 Share Posted March 12, 2021 Correct, that is the value from the database. Though it does look sorta long for a merchant id and more like token or perhaps it is encrypted by the module when it is saved -- though still seems long for just a merchant id that is encrypted. 0 Quote Link to comment Share on other sites More sharing options...
Waqas Saeed Posted March 12, 2021 Author Share Posted March 12, 2021 So, What is the code to get the params of module 'jazzcash' into hook file, if that is the scenario; Not like that. ["pp_Password"]=> string(96) "a2df9e0803d65f234d6192946800295b977d5a377d0d197631899f91d18a5108dcd335f1194597f1bee82f5db5bce7bb" ["pp_Password"]=> string(96) "Password123342" If you could help me with the sample code? @steven99 Please 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 12, 2021 Share Posted March 12, 2021 To get all values, probably easier to use the getGatewayVariables function. Search for that on the community as it wont allow me to post any code for it. 0 Quote Link to comment Share on other sites More sharing options...
Waqas Saeed Posted March 12, 2021 Author Share Posted March 12, 2021 Thanks @steven99, I just var_dump the variable, and it seems to work fine, let me continue start debugging my code. 0 Quote Link to comment Share on other sites More sharing options...
Waqas Saeed Posted March 12, 2021 Author Share Posted March 12, 2021 OH! thanks a lot, it worked, now i can feel, the pending voucher transaction has been marked paid from the hook that works by AfterCronJob. SOAP module. @steven99 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.