Create Payment
Records money a customer paid for one or more of their orders: a bank transfer (bank-transfer, the default) or cash or another offline payment (manual). customer_id must be the orders’ customer (a business’s business customer). Its amount is what the orders still owe, beyond the credit balance they use as far as the customer’s credit covers it. It pays the orders as a bank transfer into the customer’s virtual account does: their pending bank-transfer and manual payments are marked paid (a bank transfer pays a pending manual payment as a bank-transfer payment), an order gets a payment of the registration’s own for what no open payment covers, a gateway payment still pending on an order now paid in full is marked failed, and an order paid in full is confirmed. A bank transfer is also recorded in the customer’s credit balance, whose oldest credit pays the orders first: credit the customer already had is spent before this payment, which then keeps what is left. Returns the recorded payment as a PaymentDetail, its user_id the customer’s user. While payment records are briefly being updated, a bank transfer is recorded unsettled, its settlement empty, and pays the orders once the update finishes; a manual payment is refused with a 409. Fails with a 400 (errors.order_number) when an order isn’t found, belongs to another customer, is cancelled, or has nothing left to pay.