php - Visa Developer API Authentication Error -
i trying implement visa developer foreign exchange api using curl when send request, authentication error message. testing api locally , here implementation it.
data_string = $_post; $ch = curl_init('https://sandbox.api.visa.com/forexrates/v1/foreignexchangerates'); curl_setopt($ch, curlopt_httpheader, array('content-type: application/json', "accept:application/json", "authorization:".base64_encode("usernamestring:passwordstring"))); curl_setopt($ch, curlopt_url, "https://sandbox.api.visa.com/forexrates/v1/foreignexchangerates"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_postfields, json_encode($data_string)); curl_setopt($ch, curlopt_post, 1); $results = curl_exec($ch); they generate .pem certifcate not sure if have use foreign exchnage api request can please have , see if doing wrong?
this api mutual auth , call api need create app api on developer platform , need pass userid password in authorization header. userid , password specific app created , can seen in app details page.
apart authorization header need send key , cert files also. key file created during app creation , downloaded system.
please use sample code provided php platform .to access sample code need create app api.
let me know if have other questions ?
Comments
Post a Comment