1 month ago

I want my form to be submitted after successful payment JS

Posted 1 month ago by tomasosho

I want my form to submit after a successful payment. it shouldn't load up automatically.

<form action="####" name="myform" method="POST">
                    <script src=""></script>
                    @cannot ('update', $user->profile)
                        <button type="button" onclick="payWithPaystack()"> {{$prv->amount}}kobo to view </button> 
                  function payWithPaystack(){
                    var handler = PaystackPop.setup({
                      key: '####',
                      email: '{{ auth()->check()?auth()->user()->email: null}}',
                      amount: '{{$prv->amount}}',
                      currency: "NGN",
                      ref: ''+Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you
                      metadata: {
                        custom_fields: [
                                display_name: "Mobile Number",
                                variable_name: "mobile_number",
                                value: "+2348012345678"
                      callback: function(response){
                          alert('success. transaction ref is ' + response.reference);
                      onClose: function(){
                          alert('window closed');



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