...
You need to have an endpoint in your application for proxy widget's requests to Hydra Billing. For example, you can create special controller for these needs and proxy requests from widget to Billing using basic auth.
Requests:
- GET https://your.hydraservice.billingprovider.console.url/rest/v1/subjects/customers/:hydra_customer_id?accounts=on&subscriptions=on&last_payment=on
Params: hydra_customer_id — customer ID in Hydra Billing.
Response: JSON with customer data.
...
Code Block | ||
---|---|---|
| ||
<?php if(isset($_GET['hydra_customer_id'])){ $hydra_customer_id = $_GET['hydra_customer_id']; } else { $hydra_customer_id = ""; } $hoper_url = 'https://your.hoperservice.provider.console.url/'; $hoper_login = 'proxy_user_login'; $hoper_password = 'proxy_user_password'; $hoper_request_url = join('/', array(trim($hoper_url, '/'), trim("/rest/v1/subjects/customers/$hydra_customer_id?accounts=on&subscriptions=on&last_payment=on", '/'))); $curl_resource = curl_init(); curl_setopt($curl_resource, CURLOPT_URL, $hoper_request_url); curl_setopt($curl_resource, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_resource, CURLOPT_USERPWD, "$hoper_login:$hoper_password"); $curl_result = curl_exec($curl_resource); $curl_errno = curl_errno($curl_resource); $curl_error = curl_error($curl_resource); $curl_http_status = curl_getinfo($curl_resource, CURLINFO_HTTP_CODE); curl_close($curl_resource); print_r($curl_result); ?> |
...