public function charge(ChargeRequest $request)
    {
        $result = $this->request('POST', '/charges', [
            'card'     => (string) $request->getToken(),
            'amount'   => $request->getAmount() ? $request->getAmount()->getAmount() : null,
            'currency' => $request->getAmount() ? $request->getAmount()->getCurrency() : null,
            'capture'  => $request->isCapture() ? 'true' : 'false',
            'products' => json_encode($request->getProducts()),
        ]);

        return $this->objectConverter->convert($result);
    }
public function charge(ChargeRequest $request)
    {
        $result = $this->request('POST', '/charges', [
            'card'     => (string) $request->getToken(),
            'amount'   => $request->getAmount() ? $request->getAmount()->getAmount() : null,
            'currency' => $request->getAmount() ? $request->getAmount()->getCurrency() : null,
            'capture'  => $request->isCapture() ? 'true' : 'false',
            'products' => json_encode($request->getProducts()),
        ]);

        return $this->objectConverter->convert($result);
    }
public function charge ( ChargeRequest $ request ) { $ result = $ this -> request ( 'POST' , '/charges' , [ 'card' => ( string ) $ request -> getToken ( ) , 'amount' => $ request -> getAmount ( ) ? $ request -> getAmount ( ) -> getAmount ( ) : null , 'currency' => $ request -> getAmount ( ) ? $ request -> getAmount ( ) -> getCurrency ( ) : null , 'capture' => $ request -> isCapture ( ) ? 'true' : 'false' , 'products' => json_encode ( $ request -> getProducts ( ) ) , ] ) ; return $ this -> objectConverter -> convert ( $ result ) ; }
Creates a new charge.

@param  ChargeRequest $request
@return Charge

@throws RequestException
Creates a new charge .