voucherifyClient = createVoucherifyClient(); } /** * @param RedeemVoucherifyVoucherObject $redeemVoucherifyVoucherObject * @return null|object * @throws \Voucherify\ClientException */ public function execute(RedeemVoucherifyVoucherObject $redeemVoucherifyVoucherObject) { try { $result = $this->voucherifyClient->redemptions->redeem($redeemVoucherifyVoucherObject->getPromoCode(), [ "customer" => [ "source_id" => $redeemVoucherifyVoucherObject->getEmployee()->id, "name" => $redeemVoucherifyVoucherObject->getEmployee()->name, "email" => $redeemVoucherifyVoucherObject->getEmployee()->email, "metadata" => [ "exchange_company_id" => $redeemVoucherifyVoucherObject->getCompanyId(), "exchange_user_id" => $redeemVoucherifyVoucherObject->getEmployee()->id ] ], "order" => [ "amount" => $redeemVoucherifyVoucherObject->getAmount() * 100 //converting it to cents ] ]); return $result; } catch (\Voucherify\ClientException $e) { throw $e; } } }