Thank you in advance everyone. I apologize for simple questions. I do have the HTML and PHP working much like @jlrdw has posted. Works no issue. But I am storing the values for the Church pay pages and some other variables that are needed for posting. I am building this in Laravel because the church can sign up members for historical reasons. That said here is the code thus far:
Here is the Church List/Profile Page
Donations Site - Church List Page
Donations
This will be the church list.
@if($churches)
@foreach($churches as $church)
<div class="card" style="width:400px">
<img class="card-img-bottom" src="\storage\users\default.png" style="width:25%;" alt="Church image">
<div class="card-body">
<h4 class="card-title">{{$church->church_name}}</h4>
<p class="card-text">{{$church->id}}</p>
<p class="card-text">{{$church->user->name}}</p>
<a href="{{route('profile',[$church->id])}}" class="btn btn-primary">Church Page</a>
<form action="{{route('donate',[$church->id])}}" method="post">
<input class="form-control" type="text" placeholder="Name">
<input class="form-control" type="text" placeholder="Address 1">
<input class="form-control" type="text" placeholder="Address 2">
<input class="form-control" type="text" placeholder="Address 3">
<input class="form-control" type="text" placeholder="City">
<input class="form-control" type="text" placeholder="State">
<input class="form-control" type="text" placeholder="Zip">
<input class="form-control" name="x_amount" value="" placeholder="Payment Amount $" type="text">
<br>
<a href="{{route('donate',[$church->id])}}" class="btn btn-primary">Donate Route</a>
</form>
</div>
<br>
</div>
<br>
@endforeach
@endif
</div>
Here is my Route
Route::get('churchpay/{id}', 'ChurchController@donate')->name('donate');
Here is the Church controller
public function donate($id)
{
//
$churches = Church::findOrFail($id);
return view('churches.churchpay', compact('churches'));
}
Here is the Churchpay view (with detail to post to the Payeezy external site)
Church Donation Page
label {
display: block;
margin: 5px 0px;
color: #AAA;
}
input {
display: block;
}
input[type=submit] {
margin-top: 20px;
}
{!! Form::model($churches, ['method'=>'GET', 'action'=>['ChurchController@donate', $churches->id], 'files'=>true]) !!}
<div class="card card-body">
<div class="card-body">
<h1>Please wait for the secure donation page...</h1>
<h4 class="card-title">{{$churches->church_name}}</h4>
</div>
</div>
<br>
<?php
$x_login = "HCO-KW-EN-279"; // Take from Payment Page ID in Payment Pages interface
$transaction_key = "ioSB4gSXyyYiaS23BXc1"; // Take from Payment Pages configuration interface
$x_amount = $_POST["x_amount"];
$x_currency_code = "USD"; // Needs to agree with the currency of the payment page
$x_recurring_billing = "TRUE";
$x_recurring_billing_id = "MB-KW-EN-25-7722";
$x_recurring_billing_amount = "8.89";
$x_recurring_billing_start_date = "2018-08-01";
$x_recurring_billing_end_date = "2035-01-31";
srand(time()); // initialize random generator for x_fp_sequence
$x_fp_sequence = rand(1000, 100000) + 123456;
$x_fp_timestamp = time(); // needs to be in UTC. Make sure webserver produces UTC
// The values that contribute to x_fp_hash
$hmac_data = $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^" . $x_currency_code;
$x_fp_hash = hash_hmac('MD5', $hmac_data, $transaction_key);
echo ('<input name="x_login" value="' . $x_login . '" type="hidden">' );
echo ('<input name="x_amount" value="' . $x_amount . '" type="hidden">' );
echo ('<input name="x_fp_sequence" value="' . $x_fp_sequence . '" type="hidden">' );
echo ('<input name="x_fp_timestamp" value="' . $x_fp_timestamp . '" type="hidden">' );
echo ('<input name="x_fp_hash" value="' . $x_fp_hash . '" size="50" type="hidden">' );
echo ('<input name="x_currency_code" value="' . $x_currency_code . '" type="hidden">');
echo ('<input name="x_recurring_billing_amount" value="' . $x_recurring_billing_amount . '" type="hidden">' );
echo ('<input name="x_recurring_billing" value="' . $x_recurring_billing . '" type="hidden">');
echo ('<input name="x_recurring_billing_id" value="' . $x_recurring_billing_id . '" type="hidden">');
echo ('<input name="x_recurring_billing_start_date" value="' . $x_recurring_billing_start_date . '" type="hidden">');
echo ('<input name="x_recurring_billing_end_date" value="' . $x_recurring_billing_end_date . '" type="hidden">');
// create parameters input in html
foreach ($_POST as $a => $b) {
echo "<input type='hidden' name='".htmlentities($a)."' value='".htmlentities($b)."'>";
}
?>
<input type="hidden" name="x_show_form" value="PAYMENT_FORM"/>
document.myForm.submit();