5000, // Amount in cents, e.g., $50.00 'currency' => 'usd', 'description' => 'Example charge', 'source' => $token, // The token generated on the client side ]); // Check if the payment was successful if ($charge->status == 'succeeded') { echo 'Payment was successful!'; } } catch (\Stripe\Exception\CardException $e) { // Handle error (card declined, etc.) echo 'Error: ' . $e->getMessage(); } catch (Exception $e) { echo 'Error: ' . $e->getMessage(); } } /* In the backend code of your plugin, initialize Stripe with your secret API key: */ /* Needs to be stored in DB securely */ \Stripe\Stripe::setApiKey('your_secret_key'); // Replace with your Stripe Secret Key