PHP code example of augustash / commerce_stripe_enhanced

1. Go to this page and download the library: Download augustash/commerce_stripe_enhanced library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

augustash / commerce_stripe_enhanced example snippets


use Drupal\commerce_stripe_enhanced\StripePaymentElementFlowTrait;

class MyCheckoutFlow extends MultistepDefault {

  use StripePaymentElementFlowTrait;

  public function buildForm(array $form, FormStateInterface $form_state, $step_id = NULL) {
    // Before the panes build: getVisiblePanes() resolves every pane's
    // isVisible() up front, and stripe_review keys its visibility on the
    // order's gateway.
    $this->trackSelectedPaymentGateway($form_state, $step_id);
    $form = parent::buildForm($form, $form_state, $step_id);
    $this->nestPaymentElement($form);
    return $form;
  }

}
js
form.addEventListener('commerce-payment:handoff', (event) => {
  // Resolve true when the step has saved; false stops the confirm.
  event.detail.waitUntil(saveMyStep(form));
});