Question

momo sdk integration php

  • 5 January 2024
  • 1 reply
  • 23 views

good evening developers i need help. i downloaded momo sdk to integrate with my php code, i did test it with postman so i do have the api keys for the three products(collections, disbursement etc). i am also able to reach sandbox after integrating with mp php code(for testing) but im trying to call the get balance sample code and i believe i do get the feedback because i see a barrier token however i only want the account balance and not the whole information, its confusing and im not familiar with the curls although its php so i have no idea where to start inorder to get my balance request to be the only thing printed on the browser...thank for the help in advance.


1 reply

this is the feedback its an exception what do i fix: omopsdk\Common\Exceptions\MobileMoneyException Object ( [rawData:momopsdk\Common\Exceptions\MobileMoneyException:private] => [errorObj:momopsdk\Common\Exceptions\MobileMoneyException:private] => [message:protected] => Service Unavailable [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\xampp\htdocs\lets bet\dark-admin-2-0\distribution\vendor\MoMoAPIs_Php_sdk\src\Common\Utils\ResponseUtil.php [line:protected] => 170 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\xampp\htdocs\lets bet\dark-admin-2-0\distribution\vendor\MoMoAPIs_Php_sdk\src\Common\Process\BaseProcess.php [line] => 199 [function] => parse [class] => momopsdk\Common\Utils\ResponseUtil [type] => :: [args] => Array ( [0] => momopsdk\Common\Models\Response Object ( [result:momopsdk\Common\Models\Response:private] => {"message":"Service temporarily unavailable, try again later.","code":"SERVICE_UNAVAILABLE"} [info:momopsdk\Common\Models\Response:private] => Array ( [url] => https://sandbox.momodeveloper.mtn.com/disbursement/v1_0/account/balance [content_type] => application/json;charset=utf-8 [http_code] => 503 [header_size] => 240 [request_size] => 813 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.369331 [namelookup_time] => 0.00266 [connect_time] => 0.214252 [pretransfer_time] => 0.745374 [size_upload] => 0 [size_download] => 92 [speed_download] => 67 [speed_upload] => 0 [download_content_length] => 92 [upload_content_length] => 0 [starttransfer_time] => 1.368996 [redirect_time] => 0 [redirect_url] => [primary_ip] => 23.101.63.66 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => 192.168.252.5 [local_port] => 55794 [http_version] => 2 [protocol] => 2 [ssl_verifyresult] => 0 [scheme] => HTTPS [appconnect_time_us] => 744959 [connect_time_us] => 214252 [namelookup_time_us] => 2660 [pretransfer_time_us] => 745374 [redirect_time_us] => 0 [starttransfer_time_us] => 1368996 [total_time_us] => 1369331 ) [httpCode:momopsdk\Common\Models\Response:private] => 503 [error:momopsdk\Common\Models\Response:private] => [errorCode:momopsdk\Common\Models\Response:private] => 0 [referenceId:momopsdk\Common\Models\Response:private] => [headers:momopsdk\Common\Models\Response:private] => Array ( [Status] => 503 [Content-Length] => 92 [Content-Type] => application/json;charset=utf-8 [X-XSS-Protection] => 1; mode=block [Request-Context] => appId=cid-v1 [Date] => Fri, 05 Jan 2024 14 ) [requestObj:momopsdk\Common\Models\Response:private] => momopsdk\Common\Utils\RequestUtil Object ( [tokenIdentifier] => DISBURSEMENT [_method:protected] => GET [_methods:protected] => Array ( [0] => POST [1] => GET [2] => PATCH ) [_url:protected] => /disbursement/v1_0/account/balance [_params:protected] => Array ( ) [_urlParams:protected] => Array ( ) [_options:protected] => Array ( [10023] => Array ( [0] => X-Target-Environment: sandbox [1] => Ocp-Apim-Subscription-Key: 24662d402bd94b199ea59c68f5972409 [2] => Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSMjU2In0.eyJjbGllbnRJZCI6IjJhNWJlNzRjLTQ3NzItNDE0NS1iMDE0LWQ1MDk5NDA0NjEyYyIsImV4cGlyZXMiOiIyMDI0LTAxLTA1VDE1OjIyOjI4LjMwMyIsInNlc3Npb25JZCI6IjAwM2RhODA4LWZlYTctNGY4My05NjBlLTBhYzI1OGI2Y2VhMiJ9.ibR3pFcQjyexWW860cQvpQSheC3L_9v0pDTHV188LTu4P5HqWzZ4oT-nJC5XTGmdeDGII-WQvSaGXrYrSVcRnbQQ0KVCSVtm-q-QthqaKLyuk17mY1sBc9YAa1n1b3EA3N8hjTMQxczecds_KftHiRWDpKtAQwLqC9RnZPFyM4VuUoVMhCMPLJvBUn-Y6puTg0vrAzBxNeEEUiiVchIk7kilVDeI5fL3V_yMuLA-mTaYUCy5NxwWeyNPkZmODUPUM5PX1rjvBuv8g_MHfylgiootj7slrjPmzaMoHSwcR6tjNzTM9MeXigAvXoGrhWte1xq4g3PiWTtXW_OpSDA2XQ ) [80] => 1 [41] => 1 [13] => 30 [19913] => 1 [10018] => ground(ctrl) engine [42] => 1 [52] => 1 ) [_agent:protected] => ground(ctrl) engine [_contentType:protected] => [_referenceId:protected] => [_curlHandle:protected] => CurlHandle Object ( ) [subscriptionKey:protected] => 24662d402bd94b199ea59c68f5972409 [tokenType:protected] => ) ) [1] => momopsdk\Common\Models\GetAccBalance Object ( [result] => ) [2] => momopsdk\Common\Process\GetBalance Object ( [subscriptionKey:momopsdk\Common\Process\GetBalance:private] => 24662d402bd94b199ea59c68f5972409 [targetEnvironment:momopsdk\Common\Process\GetBalance:private] => sandbox [subType] => disbursement [referenceId:protected] => [callBackUrl:protected] => [retryLimit] => 2 [retryCount] => 0 [rawResponse] => momopsdk\Common\Models\Response Object ( [result:momopsdk\Common\Models\Response:private] => {"message":"Service temporarily unavailable, try again later.","code":"SERVICE_UNAVAILABLE"} [info:momopsdk\Common\Models\Response:private] => Array ( [url] => https://sandbox.momodeveloper.mtn.com/disbursement/v1_0/account/balance [content_type] => application/json;charset=utf-8 [http_code] => 503 [header_size] => 240 [request_size] => 813 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.369331 [namelookup_time] => 0.00266 [connect_time] => 0.214252 [pretransfer_time] => 0.745374 [size_upload] => 0 [size_download] => 92 [speed_download] => 67 [speed_upload] => 0 [download_content_length] => 92 [upload_content_length] => 0 [starttransfer_time] => 1.368996 [redirect_time] => 0 [redirect_url] => [primary_ip] => 23.101.63.66 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => 192.168.252.5 [local_port] => 55794 [http_version] => 2 [protocol] => 2 [ssl_verifyresult] => 0 [scheme] => HTTPS [appconnect_time_us] => 744959 [connect_time_us] => 214252 [namelookup_time_us] => 2660 [pretransfer_time_us] => 745374 [redirect_time_us] => 0 [starttransfer_time_us] => 1368996 [total_time_us] => 1369331 ) [httpCode:momopsdk\Common\Models\Response:private] => 503 [error:momopsdk\Common\Models\Response:private] => [errorCode:momopsdk\Common\Models\Response:private] => 0 [referenceId:momopsdk\Common\Models\Response:private] => [headers:momopsdk\Common\Models\Response:private] => Array ( [Status] => 503 [Content-Length] => 92 [Content-Type] => application/json;charset=utf-8 [X-XSS-Protection] => 1; mode=block [Request-Context] => appId=cid-v1 [Date] => Fri, 05 Jan 2024 14 ) [requestObj:momopsdk\Common\Models\Response:private] => momopsdk\Common\Utils\RequestUtil Object ( [tokenIdentifier] => DISBURSEMENT [_method:protected] => GET [_methods:protected] => Array ( [0] => POST [1] => GET [2] => PATCH ) [_url:protected] => /disbursement/v1_0/account/balance [_params:protected] => Array ( ) [_urlParams:protected] => Array ( ) [_options:protected] => Array ( [10023] => Array ( [0] => X-Target-Environment: sandbox [1] => Ocp-Apim-Subscription-Key: 24662d402bd94b199ea59c68f5972409 [2] => Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSMjU2In0.eyJjbGllbnRJZCI6IjJhNWJlNzRjLTQ3NzItNDE0NS1iMDE0LWQ1MDk5NDA0NjEyYyIsImV4cGlyZXMiOiIyMDI0LTAxLTA1VDE1OjIyOjI4LjMwMyIsInNlc3Npb25JZCI6IjAwM2RhODA4LWZlYTctNGY4My05NjBlLTBhYzI1OGI2Y2VhMiJ9.ibR3pFcQjyexWW860cQvpQSheC3L_9v0pDTHV188LTu4P5HqWzZ4oT-nJC5XTGmdeDGII-WQvSaGXrYrSVcRnbQQ0KVCSVtm-q-QthqaKLyuk17mY1sBc9YAa1n1b3EA3N8hjTMQxczecds_KftHiRWDpKtAQwLqC9RnZPFyM4VuUoVMhCMPLJvBUn-Y6puTg0vrAzBxNeEEUiiVchIk7kilVDeI5fL3V_yMuLA-mTaYUCy5NxwWeyNPkZmODUPUM5PX1rjvBuv8g_MHfylgiootj7slrjPmzaMoHSwcR6tjNzTM9MeXigAvXoGrhWte1xq4g3PiWTtXW_OpSDA2XQ ) [80] => 1 [41] => 1 [13] => 30 [19913] => 1 [10018] => ground(ctrl) engine [42] => 1 [52] => 1 ) [_agent:protected] => ground(ctrl) engine [_contentType:protected] => [_referenceId:protected] => [_curlHandle:protected] => CurlHandle Object ( ) [subscriptionKey:protected] => 24662d402bd94b199ea59c68f5972409 [tokenType:protected] => ) ) [processType:protected] => 1 [notificationMethod] => ) ) ) [1] => Array ( [file] => C:\xampp\htdocs\lets bet\dark-admin-2-0\distribution\vendor\MoMoAPIs_Php_sdk\src\Common\Process\GetBalance.php [line] => 58 [function] => parseResponse [class] => momopsdk\Common\Process\BaseProcess [type] => -> [args] => Array ( [0] => momopsdk\Common\Models\Response Object ( [result:momopsdk\Common\Models\Response:private] => {"message":"Service temporarily unavailable, try again later.","code":"SERVICE_UNAVAILABLE"} [info:momopsdk\Common\Models\Response:private] => Array ( [url] => https://sandbox.momodeveloper.mtn.com/disbursement/v1_0/account/balance [content_type] => application/json;charset=utf-8 [http_code] => 503 [header_size] => 240 [request_size] => 813 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.369331 [namelookup_time] => 0.00266 [connect_time] => 0.214252 [pretransfer_time] => 0.745374 [size_upload] => 0 [size_download] => 92 [speed_download] => 67 [speed_upload] => 0 [download_content_length] => 92 [upload_content_length] => 0 [starttransfer_time] => 1.368996 [redirect_time] => 0 [redirect_url] => [primary_ip] => 23.101.63.66 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => 192.168.252.5 [local_port] => 55794 [http_version] => 2 [protocol] => 2 [ssl_verifyresult] => 0 [scheme] => HTTPS [appconnect_time_us] => 744959 [connect_time_us] => 214252 [namelookup_time_us] => 2660 [pretransfer_time_us] => 745374 [redirect_time_us] => 0 [starttransfer_time_us] => 1368996 [total_time_us] => 1369331 ) [httpCode:momopsdk\Common\Models\Response:private] => 503 [error:momopsdk\Common\Models\Response:private] => [errorCode:momopsdk\Common\Models\Response:private] => 0 [referenceId:momopsdk\Common\Models\Response:private] => [headers:momopsdk\Common\Models\Response:private] => Array ( [Status] => 503 [Content-Length] => 92 [Content-Type] => application/json;charset=utf-8 [X-XSS-Protection] => 1; mode=block [Request-Context] => appId=cid-v1 [Date] => Fri, 05 Jan 2024 14 ) [requestObj:momopsdk\Common\Models\Response:private] => momopsdk\Common\Utils\RequestUtil Object ( [tokenIdentifier] => DISBURSEMENT [_method:protected] => GET [_methods:protected] => Array ( [0] => POST [1] => GET [2] => PATCH ) [_url:protected] => /disbursement/v1_0/account/balance [_params:protected] => Array ( ) [_urlParams:protected] => Array ( ) [_options:protected] => Array ( [10023] => Array ( [0] => X-Target-Environment: sandbox [1] => Ocp-Apim-Subscription-Key: 24662d402bd94b199ea59c68f5972409 [2] => Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSMjU2In0.eyJjbGllbnRJZCI6IjJhNWJlNzRjLTQ3NzItNDE0NS1iMDE0LWQ1MDk5NDA0NjEyYyIsImV4cGlyZXMiOiIyMDI0LTAxLTA1VDE1OjIyOjI4LjMwMyIsInNlc3Npb25JZCI6IjAwM2RhODA4LWZlYTctNGY4My05NjBlLTBhYzI1OGI2Y2VhMiJ9.ibR3pFcQjyexWW860cQvpQSheC3L_9v0pDTHV188LTu4P5HqWzZ4oT-nJC5XTGmdeDGII-WQvSaGXrYrSVcRnbQQ0KVCSVtm-q-QthqaKLyuk17mY1sBc9YAa1n1b3EA3N8hjTMQxczecds_KftHiRWDpKtAQwLqC9RnZPFyM4VuUoVMhCMPLJvBUn-Y6puTg0vrAzBxNeEEUiiVchIk7kilVDeI5fL3V_yMuLA-mTaYUCy5NxwWeyNPkZmODUPUM5PX1rjvBuv8g_MHfylgiootj7slrjPmzaMoHSwcR6tjNzTM9MeXigAvXoGrhWte1xq4g3PiWTtXW_OpSDA2XQ ) [80] => 1 [41] => 1 [13] => 30 [19913] => 1 [10018] => ground(ctrl) engine [42] => 1 [52] => 1 ) [_agent:protected] => ground(ctrl) engine [_contentType:protected] => [_referenceId:protected] => [_curlHandle:protected] => CurlHandle Object ( ) [subscriptionKey:protected] => 24662d402bd94b199ea59c68f5972409 [tokenType:protected] => ) ) [1] => momopsdk\Common\Models\GetAccBalance Object ( [result] => ) ) ) [2] => Array ( [file] => C:\xampp\htdocs\lets bet\dark-admin-2-0\distribution\vendor\MoMoAPIs_Php_sdk\Sample\Disbursements\GetAccountBalance.php [line] => 10 [function] => execute [class] => momopsdk\Common\Process\GetBalance [type] => -> [args] => Array ( ) ) [3] => Array ( [file] => C:\xampp\htdocs\lets bet\dark-admin-2-0\distribution\RegisterTEST.php [line] => 2 [args] => Array ( [0] => C:\xampp\htdocs\lets bet\dark-admin-2-0\distribution\vendor\MoMoAPIs_Php_sdk\Sample\Disbursements\GetAccountBalance.php ) [function] => require ) ) [previous:Exception:private] => )

Reply