mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-06 10:58:49 +00:00
55 - Making a Successful Charge
This commit is contained in:
24
app/Billing/StripePaymentGateway.php
Normal file
24
app/Billing/StripePaymentGateway.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Billing;
|
||||
|
||||
use Stripe\Charge;
|
||||
|
||||
class StripePaymentGateway implements PaymentGateway
|
||||
{
|
||||
private $apiKey;
|
||||
|
||||
public function __construct($apiKey)
|
||||
{
|
||||
$this->apiKey = $apiKey;
|
||||
}
|
||||
|
||||
public function charge($amount, $token)
|
||||
{
|
||||
Charge::create([
|
||||
'amount' => $amount,
|
||||
'source' => $token,
|
||||
'currency' => 'usd',
|
||||
], ['api_key' => $this->apiKey]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user