# Orders and Partial Payments

**URL:** <https://developer.squareup.com/forums/t/orders-and-partial-payments/9596>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [May 27, 2023, 10:36am UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596 "2023-05-27T10:36:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAH62](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@SAH62](https://developer.squareup.com/forums/u/SAH62)\
**Post date:** [May 27, 2023, 10:36am UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596/1 "2023-05-27T10:36:57Z")

</div>

I’m working on a patch for the Drupal Commerce Square Connect contrib module. The patch doesn’t currently handle payments for additional order items properly. Here’s the use case:

- An order is created, and payment is processed successfully.
- The order is edited by adding a new item is added to the order.
- Payment is submitted for the new item that’s been added to the order.

The issue is that the list of processed order items in the Commerce module includes all items associated with the order, not just the added item, and the payment amount is only for the new payment. As a result, the order cost (for all items) and the amount paid (for only the new item) are inconsistent, and Square rejects the payment.

Is there a way to submit a partial or update payment to Square?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 30, 2023, 5:36pm UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596/2 "2023-05-30T17:36:21Z")

</div>

Are you calling `UpdatePayment` for the original payment or are you looking to process and entirely new payment with the updated order\_id?

The process for this would be `CreateOrder` and `CreatePayment` with `autocomplete` set to `false`. That will get you the authorized payment. You’ll then need to check the capabilities:

```auto
"capabilities": [
            "EDIT_AMOUNT_UP",
            "EDIT_AMOUNT_DOWN",
            "EDIT_TIP_AMOUNT_UP",
            "EDIT_TIP_AMOUNT_DOWN"
        ]

```

If you can edit the amount then you can `UpdateOrder` with any new items and then call `UpdatePayment` with the new `net_amount_due_money` and call `CompletePayment` to fully complete the payment.

If your not able to edit the amount then you’ll need to process an new payment for the outstanding amount with the same `order_id`. Once that payment is authorized you’ll then call PayOrder to complete that payments. 🙂

---

<div class="post-metadata">

**Author:** ![SAH62](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@SAH62](https://developer.squareup.com/forums/u/SAH62)\
**Post date:** [May 30, 2023, 9:37pm UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596/3 "2023-05-30T21:37:50Z")

</div>

Thanks for the reply! From the Drupal Commerce perspective, this would be a new, additional payment to an existing order which has had a new item added to it. Like this:

Original order #123:  
Apple: $1  
Orange: $1  
Total payment: $2

Add “Pear” to original order $123:  
Apple: $1 (already paid)  
Orange: $1 (already paid)  
Pear: $1 (unpaid)  
Total payment: $1

Final order #123:  
Apple: $1  
Orange: $1  
Pear: $1  
Total paid: $3

Are you saying that the calls to CreateOrder and CreatePayment with autocomplete set to false would need to be done when the original order is processed, or when the order is processed to add the new item? Are any PHP code samples available?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 30, 2023, 10:10pm UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596/4 "2023-05-30T22:10:49Z")

</div>

Yes, the call to `CreatePayment` with `autocomplete` set to `false` would need to be done when the original order is processed. Orders with `COMPLETED` payments can’t add additional line items to them.

Unfortunately, we don’t have any PHP samples of this but it would be the following:

- `CreateOrder` with original items.
- `CreatePayment` with `order_id` and `autocomplete` set to `false`
- `UpdateOrder` with new item
- `CreatePayment` with original `order_id` for additional amount owed
- When ready to complete the payment call `PayOrder` with the `payment_ids` for the additional payments on the order

Please note since the order has `autocomplete` `false` the order won’t be visible in the Dashboard or POS till `PayOrder` has been called with the `payment_ids`. Once `PayOrder` is called the order is no longer able to be updated. 🙂

---

<div class="post-metadata">

**Author:** ![SAH62](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@SAH62](https://developer.squareup.com/forums/u/SAH62)\
**Post date:** [May 31, 2023, 12:51pm UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596/5 "2023-05-31T12:51:46Z")

</div>

Thanks, I don’t think this approach will work for my application. The original order is commonly paid in full before a new item is added. What usually happens is that a customer wants to add an item after they’ve placed and paid for their order. That being the case, I imagine the best way to do this is to create a new order, and a new payment, for submission to Square - correct?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 31, 2023, 4:17pm UTC](https://developer.squareup.com/forums/t/orders-and-partial-payments/9596/6 "2023-05-31T16:17:52Z")

</div>

Yes, that’s correct since tendered orders with a `COMPLETED` payment can’t be updated with additional line items. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. 🙂
