First, download stripe libraries form stripe payment official site and place into your root directory.
$amount =100;
$stripeToken = $this->request->data(‘stripeToken’);
$email = EMAIL_ADDRESS
require_once ROOT.”YOUR_ROOT_DIRECTORY”;
$stripe = array(
“secret_key” => “YOUR_SECRET_KEY”,
“publishable_key” => “YOUR_PUBLIC_KEY”
);
StripeStripe::setApiKey(‘YOUR_SECRET_KEY’);
$token=StripeToken::create([
‘card’ => [
‘number’ => CARD_NUMBER,
‘exp_month’ => CARD_EXP_MONTH,
‘exp_year’ => CARD_EXP_YEAR,
‘cvc’ => CSV,
],
]);
$customer = StripeCustomer::create(array(
’email’ => $email,
‘source’ => $token->id
));
$itemPrice = $totalamount*100;
$currency = “USD”;
$orderID = md5(time()*rand(1,10000));
$charge = StripeCharge::create(array(
‘customer’ => CUSTOMER_NAME,
‘amount’ => $itemPrice,
‘currency’ => $currency,
‘description’ => ‘Payment’,
‘metadata’ => array(
‘item_id’ => $orderID
)
));