src/Ovh/Sms/SmsClient.php
public function purchase($domain, $quantity)
    {
        if (!$domain)
            throw new BadMethodCallException('Parameter $domain is missing.');
        if (!$quantity)
            throw new BadMethodCallException('Parameter $quantity is missing.');
        $quantity = intval($quantity);
        $allowedQ = array(100, 200, 250, 500, 1000, 5000, 2500, 10000, 50000, 100000);
        if (!in_array($quantity, $allowedQ))
            throw new BadMethodCallException('Parameter $quantity must be in array (' . implode(', ', $allowedQ) . '), "' . $quantity . '" given.');
        try {
            $r = $this->post('sms/' . $domain . '/purchase', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($quantity))->send();
        } catch (\Exception $e) {
            throw new SmsException($e->getMessage(), $e->getCode(), $e);
        }
        return $r->getBody(true);
    }
public function purchase($domain, $quantity)
    {
        if (!$domain)
            throw new BadMethodCallException('Parameter $domain is missing.');
        if (!$quantity)
            throw new BadMethodCallException('Parameter $quantity is missing.');
        $quantity = intval($quantity);
        $allowedQ = array(100, 200, 250, 500, 1000, 5000, 2500, 10000, 50000, 100000);
        if (!in_array($quantity, $allowedQ))
            throw new BadMethodCallException('Parameter $quantity must be in array (' . implode(', ', $allowedQ) . '), "' . $quantity . '" given.');
        try {
            $r = $this->post('sms/' . $domain . '/purchase', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($quantity))->send();
        } catch (\Exception $e) {
            throw new SmsException($e->getMessage(), $e->getCode(), $e);
        }
        return $r->getBody(true);
    }
Purchase SMS credits

@param string $domain
@param int $quantity
@return string (json encoded object)
@throws \Ovh\Common\Exception\BadMethodCallException
@throws Exception\SmsException