aleksov
1 year ago

How to access to $ChargeResponse->email ...

Posted 1 year ago by aleksov

I use API for a credit card validator and I write at Controller:


dd($ChargeResponse);

and I got this data:

https://i.stack.imgur.com/TcIxG.png How to access this object?

I try: $ChargeResponse->_email but dont work...

UPDATE: CONTROLLER:


$CardTokenChargePayload->setEmail($request->email);
$CardTokenChargePayload->setAutoCapture('N');
$CardTokenChargePayload->setAutoCaptime('0');
$CardTokenChargePayload->setValue('10000');
$CardTokenChargePayload->setCurrency('usd');
$CardTokenChargePayload->setTrackId('Demo-0001');
$CardTokenChargePayload->setCardToken($data['cko-card-token']);
try {
    /** @var RequestModels\CardTokenChargeCreate $CardTokenChargePayload **/
    $ChargeResponse = $charge->chargeWithCardToken($CardTokenChargePayload);
    //$ChargeResponse = json_encode($ChargeResponse);
    return collect($ChargeResponse);

} catch (checkout\helpers\ApiHttpClientCustomException $e) {
    echo 'Caught exception Message: ',  $e->getErrorMessage(), "\n";
    echo 'Caught exception Error Code: ',  $e->getErrorCode(), "\n";
    echo 'Caught exception Event id: ',  $e->getEventId(), "\n";
    return response()->json(['code' => '2000', 'message' => $e->getErrorMessage()]);

Please sign in or create an account to participate in this conversation.