You can do it by simply adding 10% markup to the main service price obtained through an API. Here's how you can achieve it in Laravel:
Firstly, obtain the main service price from the API using the GuzzleHTTP client or any other suitable HTTP client.
Once you have obtained the main service price, calculate the 10% markup. You can use the following formula:
markup = main_service_price * 0.10
total_price = main_service_price + markup
Example code:
use GuzzleHttp\Client;
public function getServicePrice()
{
$client = new Client();
$response = $client->get('http://api.example.com/service/price');
$main_service_price = json_decode($response->getBody()->getContents(), true)['price'];
// Apply 10% markup
$markup = $main_service_price * 0.10;
$total_price = $main_service_price + $markup;
return $total_price;
}
Note: It is important to ensure that the API license agreement allows for the additional markup to be applied to the service price.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-07 11:30:18 +0000
Seen: 16 times
Last updated: Jun 07 '23