Я хотел бы интегрировать платежный шлюз Paymaya в свое приложение, но у меня возникла проблема, потому что я понятия не имею об API.
Это мое руководство. https://github.com/aceraven777/laravel-paymaya, мне удалось все установить.
Я создал эти файлы в моем Libraries \ Paymaya, но не уверен с именем моего файла.
**Setting up Webhooks**
**Customize Merchant Page**
**Checkout**
**Webhook Callback**
**Refund Payment**
**Get refund attempts of a checkout.**
**Retrieve information of a particular refund.**
На мой взгляд, у меня есть фиксированные значения и кнопка отправки.
Просмотр
<form id="check-out">
<div class="table-responsive get-other-receivable-table">
<table id="get-other-receivable-table" class="table table-striped table-bordered table-sm">
<thead class="thead-global">
<tr>
<th>Inventory Name</th>
<th>Qty</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Laptop<input type="hidden" name="inventories[]" value="1" readonly=""></td>
<td>10<input type="hidden" name="quantities[]" value="10" readonly=""></td>
<td>20000<input type="hidden" name="prices[]" value="20000" readonly=""></td>
</tr>
<tr>
<td>Cellphone<input type="hidden" name="inventories[]" value="2" readonly=""></td>
<td>10<input type="hidden" name="quantities[]" value="10" readonly=""></td>
<td>9000<input type="hidden" name="prices[]" value="9000" readonly=""></td>
</tr>
</tbody>
</table>
</div>
<div class="pull-right">
<button type="submit" class="btn btn-sm btn-success">CHECKOUT</button>
</div>
</form>
Jquery
$(document).ready(function(){
if ( $('#check-out').length > 0 ) {
$('#check-out').submit(function(e){
var formData = $(this).serialize();
swal({
title: "Are you sure?",
text: "Transaction will be saved to the database.",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willSave) => {
if (willSave) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
})
$.ajax({
url: '/paymaya-checkout',
type: "POST",
data: formData,
beforeSend: function() {
var span = document.createElement("span");
span.innerHTML = '<span class="loading-animation">LOADING...</span>';
swal({
content: span,
icon: "warning",
buttons: false,
closeOnClickOutside: false
});
$('.other-payables-finish').attr('disabled', 'disabled');
},
success: function(response) {
if (response != '') {
$('#get-other-payable-table').DataTable().destroy();
getOtherPayablesTable();
$('#add-other-payable-form').trigger("reset");
swal("Transaction has been saved!", {
icon: "success",
});
setTimeout(
function()
{
window.location.href = "/purchases/my-other-payables?id="+response+"#view-other-payable-modal";
}, 1500);
}
},
complete: function() {
$('.other-payables-finish').removeAttr('disabled');
}
});
} else {
swal("Save Aborted");
}
});
e.preventDefault();
return false;
})
}
});
После отправки он будет перенаправлен на этот контроллер.
Контроллер
public function checkout(Request $request)
{
$data = $request->all();
dd($data);
$checkout = Checkout::checkout($data);
}
Вопрос: Как передать мои значения, полученные в моем представлении, касса паймая?