@extends('OmniPayViews::layouts.redirection-layout')


<?php


$url_success = env('APP_URL').'/omnipay/response/success?paid='.$id;
$url_cancel = env('APP_URL');

?>

@section('title')<title>Redirecting Airwallex</title>@endsection

@section('content')


<button id="hpp">Checkout</button>

@endsection

@section('scripts')
<script src="https://checkout.airwallex.com/assets/elements.bundle.min.js"></script>

<script language="javascript">
    Airwallex.init({
        env: 'prod', // Setup which Airwallex env('staging' | 'demo' | 'prod') to integrate with
        origin: window.location.origin, // Setup your event target to receive the browser events message
    });

    Airwallex.redirectToCheckout({
        env: 'prod', // Which env('staging' | 'demo' | 'prod') you would like to integrate with
        intent_id: '{{$intent_id}}',
        client_secret: '{{$client_secret}}',
        currency: '{{$currency}}',
        successUrl : '{{$url_success}}',
        failUrl : '{{$url_cancel}}'
    });

    $("#hpp").click();

</script>
@endsection
