<script src="{{$url}}/paymentWidgets.js?checkoutId={{$checkout_id}}"></script>


<form action="{{$url_success}}" class="paymentWidgets" data-brands="{{implode(" " ,$brands)}}"></form>

@if(in_array("APPLEPAY" , $brands))

    <script type="text/javascript">


        var supportedNetworks = "{{implode(',' ,$brands)}}";
        var supportedNetworksArray = supportedNetworks.split(",");

        supportedNetworksArray = supportedNetworksArray.map(network => {
            return network.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
                if (+match === 0) return "";
                return index === 0 ? match.toLowerCase() : match.toUpperCase();
            });
        });

        var wpwlOptions = {
            paymentTarget:"_top",
            applePay : {
                merchantCapabilities:["supports3DS"],
                supportedNetworks: supportedNetworksArray,
                countryCode: "{{$country_code}}",
            }
        }
    </script>

@else
    <script type="text/javascript">
        var wpwlOptions = {
            paymentTarget:"_top",

        }
    </script>
@endif
