Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/./../app/.././../../finland.picotech.app/public_html/storage/../vendor/./nikic/../dompdf/../alexandr-mironov/../guzzlehttp/../././sebastian/lines-of-code/.././version/../../africastalking/africastalking/../../laminas/../phenx/../paytm/../dompdf/../barryvdh/./../masterminds/../../Modules/PaymentGateway/SenderIdPurchaseGateway
الملفات الموجودة في هذا الـ Path:
.
..
AuthorizeNetPayment.php
CashmallPayment.php
IyzicoPayment.php
MolliePayment.php
PayPalPayment.php
Payment.php
PaymentGateway.php
PaymentInterface.php
PaystackPayment.php
PaytmPayment.php
ProcessPayment.php
SSLCommerz.php
StripeCheckoutPayment.php
StripePayment.php
Uddoktapay.php
مشاهدة ملف: StripeCheckoutPayment.php
<?php
namespace Modules\PaymentGateway\SenderIdPurchaseGateway;
use Illuminate\Support\Facades\Log;
class StripeCheckoutPayment implements PaymentInterface
{
public $numberReq;
public $redirect_url;
public $error_message;
public $return_view;
public $will_redirect = false;
public function __construct()
{
}
public function pay()
{
// TODO: Implement pay() method.
}
public function senderId($senderId)
{
$this->sender_id = $senderId;
return $this;
}
public function getCredentials()
{
$credentials = json_decode(get_settings('payment_gateway'));
if (!$credentials->stripe_pub_key || !$credentials->stripe_secret_key) {
throw new \Exception('Credentials not found. Please contact with the administrator');
}
return $credentials;
}
public function will_redirect()
{
// TODO: Implement will_redirect() method.
return $this->will_redirect;
}
public function redirect_url()
{
// TODO: Implement redirect_url() method.
return $this->redirect_url;
}
public function return_view()
{
// TODO: Implement redirect_url() method.
return $this->return_view;
}
public function error_message()
{
// TODO: Implement error_message() method.
return $this->error_message;
}
public function process()
{
// dd('lol');
try {
$credentials= $this->getCredentials();
\Stripe\Stripe::setApiKey($credentials->stripe_secret_key);
$success = route('customer.sender-id.index');
$stripe = new \Stripe\StripeClient(
$credentials->stripe_secret_key
);
$product= $stripe->products->create([
'name' => 'senderid_'.$this->sender_id->id,
]);
$price = json_decode(get_settings('senderid_price'))->sender_id_price;
$price= $stripe->prices->create([
'unit_amount' => $price *100,
'currency' => 'usd',
'product' => $product->id,
]);
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
'price' => $price->id,
'quantity' => 1,
]],
'mode' => 'payment',
'success_url' => $success,
'cancel_url' => route('paymentgateway::sender.id.payment.process.cancel'),
]);
$this->redirect_url = $checkout_session->url;
$this->will_redirect = true;
$this->return_view = null;
} catch (\Exception $ex) {
Log::error($ex->getMessage());
$this->error_message= $ex->getMessage();
}
}
/*Custom Function*/
}