PHP code example of haneul-chile / flow

1. Go to this page and download the library: Download haneul-chile/flow library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

haneul-chile / flow example snippets


$params = [
    'date' => '2023-01-10'
];

$response = Flow::getFlow('/payment/getPayments', $params);

$params = [
    'commerceOrder' => 151,
    'subject' => 'test de pago',
    'amount' => '10000',
    'email' => '[email protected]',
    'urlConfirmation' => Flow::getUrlConfirmation(),
    'urlReturn' => Flow::getUrlReturn(),
    'paymentMethod' => '9'
];

$response = Flow::postFlow('/payment/create', $params);

return redirect($response->url . "?token=" . $response->token);

public function return(Request $request)
{
    $token = $request->token;
    $params = [
        'token' => $token
    ];

    $response = Flow::getFlow('/payment/getStatus', $params);

    if ($response->status == 1) {
        //Acá el cliente volvió a tu sitio web
        return 'back';
    }
    if ($response->status == 2) {
        //Acá el cliente realizo el pago exitosamente
        return 'exito';
    }
    //Acá el pago del cliente fue rechazado
    return 'fracaso';
}

public function confirmation(Request $request)
{
    $token = $request->token;
    $params = [
        'token' => $token
    ];

    $response = Flow::getFlow('/payment/getStatus', $params);

    //Acá debes actualizar el pago en tu web como "pagado"
}