<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php echo e((isset($page_title) ? __($page_title) : __("Public"))); ?></title>
<link
href="https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Source+Serif+4:opsz,wght@8..60,300;8..60,400;8..60,500;8..60,600;8..60,700;8..60,900&display=swap"
rel="stylesheet">
<?php echo $__env->make('partials.header-asset', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->yieldPushContent('css'); ?>
</head>
<body>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Start body overlay
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<div id="body-overlay" class="body-overlay"></div>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
End body overlay
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Start Payment-preview
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<section class="checkout-section">
<div class="row justify-content-center">
<div class="col-xl-5 col-lg-6 col-md-8">
<div class="checkout-wrapper">
<div class="checkout-top-area">
<div class="profile-area">
<img src="<?php echo e(auth()->user()->userImage ?? asset('public/frontend/images/user/user-1.png')); ?>"
alt="client">
</div>
<div class="logo-area">
<img src="<?php echo e(get_logo($basic_settings)); ?>"
alt="logo">
</div>
</div>
<form class="checkout-form" action="<?php echo e(setRoute('order.checkout.submit',$order->identifier)); ?>" method="POST">
<?php echo csrf_field(); ?>
<div class="account-info-wrapper">
<div class="checkout-user">
<h5 class="title"><?php echo e(auth()->user()->fullname); ?></h5>
<span><?php echo e(auth()->user()->email); ?></span>
</div>
<div class="checkout-amount">
<p><?php echo e(get_amount(@$order->data->total_payable,@$order->data->currency)); ?></p>
</div>
</div>
<div class="switch-wrapper">
<h4 class="title"><?php echo e(__("Pay with")); ?></h4>
</div>
<input type="hidden" name="type" id="paymentType">
<div class="radio-wrapper">
<?php $__empty_1 = true; $__currentLoopData = $card_payments ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<div class="radio-item">
<div class="radio-item-wrapper">
<input type="radio" name="card_payment" value="<?php echo e($item->id); ?>" data-type="card">
<label for="card-<?php echo e($item->id); ?>">
<div class="content">
<h6 class="title"><?php echo e(decrypt($item->name) ?? ''); ?></h6>
<p><?php echo e(__("Card")); ?>: ****<?php echo e(substr(decrypt($item->card_number), -4)); ?></p>
</div>
</label>
</div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<div class="alert alert-primary text-center">
<?php echo e(__("You don't have any card. Please create a card.")); ?>
</div>
<?php endif; ?>
<div class="radio-item">
<div class="radio-item-wrapper">
<input type="radio" name="card_payment" value="<?php echo e($user_wallet->id); ?>" data-type="wallet">
<label for="wallet-type">
<div class="content">
<h6 class="title"><?php echo e(__("From")); ?> <?php echo e($user_wallet->currency->code); ?></h6>
<h6 class="title"><?php echo e(__("Wallet")); ?> (<?php echo e(get_amount($user_wallet->balance, $user_wallet->currency->code)); ?>)</h6>
</div>
</label>
</div>
</div>
<input type="hidden" name="identifier" value="<?php echo e(@$order->identifier); ?>">
</div>
<div class="btn-area">
<button type="submit" class="btn--base w-100"><?php echo e(__("Continue to Review Order")); ?><i
class="las la-angle-right ms-1"></i></button>
</div>
<a href="<?php echo e(@$order->data->cancel_url); ?>"
class="home-btn"><?php echo e(__("Cancel and return to Home")); ?></a>
</form>
</div>
</div>
</div>
</div>
</section>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
End Payment-preview
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<?php echo $__env->make('partials.footer-asset', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<script>
$(document).ready(function() {
function updatePaymentType() {
const selectedOption = $("input[name='card_payment']:checked");
const paymentTypeInput = $("#paymentType");
if (selectedOption.length > 0) {
paymentTypeInput.val(selectedOption.data("type"));
}
}
$("input[name='card_payment']").change(updatePaymentType);
updatePaymentType();
});
</script>
</body>
</html><?php /**PATH D:\xampp\htdocs\git\nfcpay\resources\views/order/pages/checkout.blade.php ENDPATH**/ ?>
Initiates a new payment transaction.
create-order
| Parameter | Type | Details |
|---|---|---|
| amount | decimal | Your Amount , Must be rounded at 2 precision. |
| currency | string | Currency Code, Must be in Upper Case (Alpha-3 code) |
| success_url | string | Enter your return or success URL |
| cancel_url | string (optional) | Enter your cancel or failed URL |
Request Example (guzzle)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', $base_url.'create-order', [
'headers' => [
'Authorization' => 'Bearer '. $authorizationToken,
'accept' => 'application/json',
'content-type' => 'application/json',
],
'form_params' => [
'amount' => '$amount',
'currency' => 'currency',
'success_url' => 'success_url',
'cancel_url' => 'cancel_url',
],
]);
echo $response->getBody();
**Response: SUCCESS (200 OK)**
{
"message": {
"success": [
"Order created successfully."
]
},
"data": {
"redirect_url":"https://example.com/login/OISADFDFSDFSF",
"order_details":{
"amount" : "10",
"fixed_charge" : 2,
"percent_charge" : 1,
"total_charge" : 3,
"total_payable" : 13,
"currency" : "USD",
"expiry_time": "2024-04-25T06:48:35.984285Z",
"success_url": "http://127.0.0.1/nfcpay/user/transaction/success",
"cancel_url": "http://127.0.0.1/nfcpay/user/transaction/cancel"
}
},
"type": "success"
}
**Response: ERROR (400 FAILED)**
{
"message": {
"error": [
"Invalid token."
]
},
"data": null,
"type": "error"
}