Stripe is a commonly using payment gateway. For integrating stripe in drupal 8 requires stripe library. We can install stripe library using composer. Use the following command to install stripe library.

public function buildForm(array $form, FormStateInterface $form_state) {
  "********************", //Give your api keys for stripe account
  "********************" //Give your api keys for stripe account
  \Stripe\Stripe: :setApiKey($stripe['secret_key']);
  $stripe_email=$_SESSION['stripe_email']; //Give your mail id
  $amount=100; //Give your  amount to be transfer
  $stripe amount=$amount *100;
  $form ['pay_button']=array('#type'=>
  new FormattableMarkup('<p><script             src="" class="stripe-button"
data-key="' . $stripe['publishable_key'] . '"data- data-amount="' . $stripe amount . '"data-description="User Registration"data-currency="EUR"data-email="' .  $stripe_email . '">
  ', []),
  return $form;
* {@inheritdoc}
public function submitForm(array &
$form, FormStateInterface $form_state) {
  \Stripe\Stripe: :setApiKey($stripe['secret_key']);
  $customer=\Stripe\Customer: :create(array('email'=>
  $mail, //give your mail id
  $description="User Registration";
  $charge=\Stripe\Charge: :create(array("amount"=>
  $amount, //Give your  amount to be transfer,
  "EUR", //You can change the currency format
  $msg="Successfully charged ".$amount;

The easiest way to solve an issue is to let it deal by experts. We can provide a wide range of services, which will help you maintain and manage your websites. Get in touch with us to know more.