5 months ago


Posted 5 months ago by ljlizarraga

UnexpectedValueException The Response content must be a string or object implementing __toString(), "object" given.

    <?phpnamespace App\Http\Controllers;//use App\Transaction;  
use Carbon\Carbon;  
use Freshwork\Transbank\CertificationBagFactory;  
use Freshwork\Transbank\RedirectorHelper;  
use Freshwork\Transbank\TransbankServiceFactory;  
use Freshwork\Transbank\WebpayOneClick;  
use Illuminate\Http\Request;  
use App\Http\Requests;  
use Freshwork\Transbank\WebpayNormal;class WebPayController extends Controller  
  protected $oneclick;  
  public function __construct()  
      $bag = CertificationBagFactory::integrationOneClick();  
      $this->oneclick = TransbankServiceFactory::oneclick($bag);  
  }    public function index(){  
      return view('layouts.pages.pagoFacil');  
  public function Pagar(WebpayNormal $webPayNormal,Request $request)  
     // $webPayNormal = new( webPayNormal());  
      $webPayNormal->addTransactionDetail(1500, 'order-' . rand(1000, 9999));  
      return $webPayNormal;  
              $response = $webPayNormal->initTransaction(route('pagoFacil.webpay.response'), route('pagoFacil.webpay.finish'));  
              // Probablemente también quieras crear una orden o transacción en tu base de datos y guardar el token ahí.  
      return RedirectorHelper::redirectHTML($response->url, $response->token);  

enter image description here

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