Answers.Body: <p>We touch on this in the upgrade guide, under the <a href="https://craftcms.com/docs/commerce/4.x/upgrading.html#payment-forms" rel="nofollow noreferrer">Payment Forms</a> section.</p>
  <p>The examples provided are specific to Twig, because that is Craft’s singular, built-in template language—if you are assembling this form data in a client-side application, you would be responsible for replicating the output’s structure (as far as the nesting of variables in a <code>FormData</code> payload).</p>
  <p>Check out the Ajax section on our <a href="https://craftcms.com/docs/4.x/dev/controller-actions.html" rel="nofollow noreferrer">Controller Actions</a> page for more information about sending data to the back-end!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-24T18:34:51.537Z
Answers.LastActivityDate: 2024-01-24T18:34:51.537Z
Answers.UserDisplayName: August Miller
Body: <p>I'm in the process of migrating Craft Commerce 3 to 4.</p>
  <p>I handle the payments forms with VueJS, and I've been struggling to understand why my paymentMethod body params were ignored after the migration.</p>
  <p>I had to read Commerce’s code to understand that input's names had to change from <code>name='payementMethod'</code> to <code>:name=&quot;`paymentForm[${gatewayName}][paymentMethod]`&quot;</code> as <code>getBodyParam()</code> calls use <code>getPaymentFormParamName()</code> as part of the key.</p>
  <p>Anyway, where could I have found this information ? Did not found anything in the migration guide, nor the doc.</p>
  <p>Did I missed it ?</p>
  <p>Have a nice day !</p>
  
Tags: <plugin-craftcommerce><documentation>
Title: Payment form differences between Commerce 3 and Commerce 4 in headless application
ThreadText: # Payment form differences between Commerce 3 and Commerce 4 in headless application
  
  (Asked by: username_0 on 2024-01-23)
  
  I'm in the process of migrating Craft Commerce 3 to 4.
  
  I handle the payments forms with VueJS, and I've been struggling to understand why my paymentMethod body params were ignored after the migration.
  
  I had to read Commerce’s code to understand that input's names had to change from `name='payementMethod'` to `:name="`paymentForm[${gatewayName}][paymentMethod]`"` as `getBodyParam()` calls use `getPaymentFormParamName()` as part of the key.
  
  Anyway, where could I have found this information ? Did not found anything in the migration guide, nor the doc.
  
  Did I missed it ?
  
  Have a nice day !
  
  **Tags:** plugin-craftcommerce, documentation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-24. Score: 2 | Accepted answer
  
  We touch on this in the upgrade guide, under the [Payment Forms](https://craftcms.com/docs/commerce/4.x/upgrading.html#payment-forms) section.
  
  The examples provided are specific to Twig, because that is Craft’s singular, built-in template language—if you are assembling this form data in a client-side application, you would be responsible for replicating the output’s structure (as far as the nesting of variables in a `FormData` payload).
  
  Check out the Ajax section on our [Controller Actions](https://craftcms.com/docs/4.x/dev/controller-actions.html) page for more information about sending data to the back-end!
  
  
  ---
  
  