Change record status: 
Project: 
Introduced in branch: 
8.x-2.x
Introduced in version: 
8.x-2.12
Description: 

The commerce_payment_gateway_form, commerce_profile_select, commerce_coupon_redemption_form form elements have been deprecated. Use the "payment_gateway_form", "customer_profile", "coupon_redemption" inline forms instead.

Before:

$form['payment_method'] = [
  '#type' => 'commerce_payment_gateway_form',
  '#operation' => 'edit-payment-method',
  '#default_value' => $this->entity,
];

After:

$inline_form = $this->inlineFormManager->createInstance('payment_gateway_form', [
  'operation' => 'edit-payment-method',
], $this->entity);

$form['payment_method'] = [
  '#parents' => ['payment_method'],
  '#inline_form' => $inline_form,
];
$form['payment_method'] = $inline_form->buildInlineForm($form['payment_method'], $form_state);

Inline forms are automatically validated and submitted, just like the previous form elements.
To access the modified entity in a validate/submit callback, use $inline_form->getEntity()

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    /** @var \Drupal\commerce\Plugin\Commerce\InlineForm\EntityInlineFormInterface $inline_form */
    $inline_form = $form['payment_method']['#inline_form'];
    /** @var \Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method */
    $payment_method = $inline_form->getEntity();
    // Do something with the payment method.
  }
Impacts: 
Module developers