<?php if($basic_settings->push_notification_config != null && $basic_settings->push_notification_config->method == "pusher"): ?>
<script src="https://js.pusher.com/beams/1.0/push-notifications-cdn.js"></script>
<script>
var clientInstanceId = "<?php echo e($basic_settings->push_notification_config->instance_id); ?>";
const beamsClient = new PusherPushNotifications.Client({
instanceId: clientInstanceId,
});
var generatePublisherId = "<?php echo e(make_user_id_for_pusher('admin', auth()->user()->id)); ?>";
const beamsTokenProvider = new PusherPushNotifications.TokenProvider({
url: "<?php echo e(setRoute('admin.pusher.beams.auth')); ?>",
});
beamsClient
.start()
.then((beamsClient) => beamsClient.getDeviceId())
.then((response) => beamsClient.setUserId(generatePublisherId, beamsTokenProvider))
.catch(console.error());
</script>
<?php endif; ?>
<?php if($basic_settings->broadcast_config != null && $basic_settings->broadcast_config->method == "pusher"): ?>
<script src="https://js.pusher.com/7.2/pusher.min.js"></script>
<script>
var primaryKey = "<?php echo e($basic_settings->broadcast_config->primary_key ?? ''); ?>";
var cluster = "<?php echo e($basic_settings->broadcast_config->cluster ?? ""); ?>";
var pusher = new Pusher(primaryKey, {
cluster: cluster,
});
var channel = pusher.subscribe('admin');
channel.bind('dashbord-push', function(data) {
var jsonData = JSON.stringify(data);
var object = JSON.parse(jsonData);
document.querySelector(".header-notification-area .bling-area").classList.remove("d-none");
document.querySelector(".notifications-clear-all-btn").classList.remove("d-none");
var message = `
<li>
<div class="thumb">
<img src="${object.message.image}" alt="user">
</div>
<div class="content">
<h6 class="title">${object.message.title}</h6>
<span class="sub-title">${object.message.time}</span>
</div>
</li>
`;
if(document.querySelector(".notification-list .not-found") != null) {
document.querySelector(".notification-list .not-found").remove();
}
document.querySelector(".notification-wrapper .notification-list").innerHTML += message;
});
</script>
<?php endif; ?>
<?php /**PATH /home/kueuepay/public_html/resources/views/admin/partials/push-notification.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"
}