namespace MyCo\Zoho\Resources\Payments;
use ZohoSubscription\Contracts\Requestable;
use ZohoSubscription\Partials\HasRequestables;
class Payment implements Requestable
{
use HasRequestables;
public function __construct(string $customerId, int $amount, string $paymentMode)
{
$this->attributes['customer_id'] = $customerId;
$this->attributes['amount'] = $amount;
$this->attributes['payment_mode'] = $paymentMode;
}
/**
* @return string
* @throws \Exception
*/
public function getUri(): string
{
return 'payments';
}
/**
* @return string
* @throws \Exception
*/
public function getId(): string
{
if (is_null($this->response)) {
throw new \Exception('Trying to get ID when request not sent yet');
}
return json_decode($this->response->getBody())->payment->payment_id;
}
}
$payment = new MyCo\Zoho\Resources\Payments($customerId, $amount, 'cash');
$paymentId = $client->send($payment)->getId();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.