Answers.Body: <p>This is certainly still possible with Commerce 3 and Craft 3.</p>
  <p>In a custom plugin or module you can listen for the <code>Transactions::EVENT_AFTER_CREATE_TRANSACTION</code> event and amend the transaction amount at this point in the process.</p>
  <p>For example, you could make your own payment form that includes a <code>partPaymentAmount</code> field and posts to the normal <code>commerce/payments/pay</code> controller action.</p>
  <p>Then in your event listener to the <code>Transactions::EVENT_AFTER_CREATE_TRANSACTION</code> event, test to see if a value exists for the <code>partPaymentAmount</code> POST variable. If it does, amend the transaction amount accordingly. The payment should proceed with the amended amount, so long as it is still a valid amount to pay against the current order (i.e. it is less than or equal to the total amount of the order).</p>
  <p>The nice thing about doing it this way is that it is a very light touch on Commerce and still utilises the existing Commerce workflow for processing the transaction and making sure that everything is updated properly.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-10T09:36:56.540Z
Answers.Text: Thank you Steve, will have a look and implement this solution.
Answers.UserDisplayName: José Veríssimo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-10T10:16:42.200Z
Answers.Text: Using the Transactions::EVENT_AFTER_CREATE_TRANSACTION event, I can change the paymentAmount variable and it works exactly how I wanted it. Thanks for the tips again Steve.
Answers.UserDisplayName: José Veríssimo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-10T09:28:58.927Z
Answers.LastActivityDate: 2020-11-10T09:28:58.927Z
Answers.UserDisplayName: Steve Rowling
Body: <p>Is there any way of partially paying for an order, so if the order total amount was $100, how can I programmatically set the payment amount to $50, and then pay the other $50 using another payment method later on?</p>
  <p>There was a way to do this in Craft2 using a custom plugin, but in Craft3 I tried using the <code>Payments::EVENT_BEFORE_PROCESS_PAYMENT</code> event but the variable is <code>null</code> in the <code>$event-&gt;transaction</code>.</p>
  <p>Please let me know, thank you!</p>
  
Tags: <plugin-development><craft3><plugin-craftcommerce><ecommerce><plugin-craftcommerce3>
Title: Partially pay for an order
ThreadText: # Partially pay for an order
  
  (Asked by: username_0 on 2020-11-10)
  
  Is there any way of partially paying for an order, so if the order total amount was $100, how can I programmatically set the payment amount to $50, and then pay the other $50 using another payment method later on?
  
  There was a way to do this in Craft2 using a custom plugin, but in Craft3 I tried using the `Payments::EVENT_BEFORE_PROCESS_PAYMENT` event but the variable is `null` in the `$event->transaction`.
  
  Please let me know, thank you!
  
  **Tags:** plugin-development, craft3, plugin-craftcommerce, ecommerce, plugin-craftcommerce3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-10. Score: 4 | Accepted answer
  
  This is certainly still possible with Commerce 3 and Craft 3.
  
  In a custom plugin or module you can listen for the `Transactions::EVENT_AFTER_CREATE_TRANSACTION` event and amend the transaction amount at this point in the process.
  
  For example, you could make your own payment form that includes a `partPaymentAmount` field and posts to the normal `commerce/payments/pay` controller action.
  
  Then in your event listener to the `Transactions::EVENT_AFTER_CREATE_TRANSACTION` event, test to see if a value exists for the `partPaymentAmount` POST variable. If it does, amend the transaction amount accordingly. The payment should proceed with the amended amount, so long as it is still a valid amount to pay against the current order (i.e. it is less than or equal to the total amount of the order).
  
  The nice thing about doing it this way is that it is a very light touch on Commerce and still utilises the existing Commerce workflow for processing the transaction and making sure that everything is updated properly.
  
  > **Comments:**
  > **username_0**: Thank you username_1, will have a look and implement this solution.  
  > **username_0**: Using the Transactions::EVENT_AFTER_CREATE_TRANSACTION event, I can change the paymentAmount variable and it works exactly how I wanted it. Thanks for the tips again username_1.  
  
  ---
  
  