# Payments

Section: Invoices and payments. Part of the [API reference](https://developer.yoprint.com/reference.md). Web page: https://developer.yoprint.com/reference/payments/

This page and all 21 operation pages, in 4 files: https://developer.yoprint.com/llms/payments.txt (operations 1 to 3), https://developer.yoprint.com/llms/payments-2.txt (operations 4 to 8), https://developer.yoprint.com/llms/payments-3.txt (operations 9 to 17), https://developer.yoprint.com/llms/payments-4.txt (operations 18 to 21)

Payments, refunds and customer credit on a sales order: payments you record yourself, card payments through a connected gateway, and Square Terminal checkouts.

## Operations (10)

- [Record a payment on a sales order](https://developer.yoprint.com/reference/payments/v2-sales-order-manual-payment-store.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment`. Records a payment you received outside YoPrint, such as cash, a check or a bank transfer.
- [Record a refund of a payment](https://developer.yoprint.com/reference/payments/v2-sales-order-manual-payment-refund.md): `PUT /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{id}/refund`. Records that you gave back some or all of a payment outside YoPrint.
- [List the payments of a sales order](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-index.md): `GET /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment`. Returns every money record on an order, newest first and all at once (no pagination): payments, refunds, customer credit moves (`subtype` `TRANSFER`), voided card payments, Shopify payments, and…
- [Get one payment of a sales order](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-show.md): `GET /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_reference}`. Returns one money record of the order (a payment, refund or credit move), with the same fields as the list, dispute fields included.
- [Pay an order from the customer's credit](https://developer.yoprint.com/reference/payments/v2-sales-order-credit-pay-with-customer-credit.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/credit/pay_with_customer_credit`. Uses the customer's credit balance to pay part of the order.
- [Move all of an order's payments to customer credit](https://developer.yoprint.com/reference/payments/v2-sales-order-credit-refund-all-to-customer-credit.md): `PATCH /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/credit/refund_all_to_customer_credit`. Moves everything paid on the order to the customer's credit.
- [Move part of an order's payments to customer credit](https://developer.yoprint.com/reference/payments/v2-sales-order-credit-refund-to-customer-credit.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/credit/refund_to_customer_credit`. Takes some of what the customer paid on this order and keeps it as their credit, to use on another order.
- [Refund a card payment through the gateway](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-gateway-refund.md): `PUT /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment_gateway_refund/{id}`. Refunds a card payment through the gateway that took it: real money goes back to the card.
- [Update a recorded payment](https://developer.yoprint.com/reference/payments/v2-sales-order-manual-payment-update.md): `PUT /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_reference}`. Changes a recorded payment's date, references and, for a payment recorded in YoPrint, its payment method.
- [Delete a payment or refund](https://developer.yoprint.com/reference/payments/v2-sales-order-manual-payment-destroy.md): `DELETE /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_reference}`. Deletes a payment or refund record from the order.

## Legacy and internal operations (11)

Prefer the operations above. Legacy ones name their replacement; internal ones are built for YoPrint's own apps.

- [Start a Square Terminal checkout (v1)](https://developer.yoprint.com/reference/payments/v1-sales-order-payment-square-terminal-create.md): `POST /v1/api/store/{team_slug}/sales_order/{hash_id}/square_terminal/create` (legacy, deprecated). The older path for starting a Square Terminal checkout.
- [Check a pending card payment (v1, not usable)](https://developer.yoprint.com/reference/payments/v1-sales-order-payment-gateway-polling.md): `POST /v1/api/store/{team_slug}/sales_order/poll_pending_payment` (legacy, deprecated). Meant to check a pending card payment.
- [Refund a card payment (v1)](https://developer.yoprint.com/reference/payments/v1-sales-order-payment-gateway-refund.md): `PUT /v1/api/store/{team_slug}/sales_order/{hash_id}/payment_gateway_refund/{id}` (legacy, deprecated). The older path for refunding a card payment.
- [Charge a card through the gateway (v1)](https://developer.yoprint.com/reference/payments/v1-sales-order-payment-gateway-execute.md): `POST /v1/api/store/{team_slug}/sales_order/{hash_id}/payment/{payment_gateway}` (legacy, deprecated). The older path for charging a card (`{payment_gateway}` is the gateway name).
- [Prepare a card payment (v1)](https://developer.yoprint.com/reference/payments/v1-sales-order-payment-gateway-pre-execute.md): `POST /v1/api/store/{team_slug}/sales_order/{hash_id}/payment/{payment_gateway}/pre_execute` (legacy, deprecated). The older path for preparing a card payment.
- [Cancel a Square Terminal checkout (v1)](https://developer.yoprint.com/reference/payments/v1-sales-order-payment-square-terminal-cancel.md): `PATCH /v1/api/store/{team_slug}/sales_order/{hash_id}/square_terminal/{checkout_id}/cancel` (legacy, deprecated). The older path for cancelling a Square Terminal checkout.
- [Start a Square Terminal checkout](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-square-terminal-create.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/square_terminal/create` (internal: built for YoPrint's own apps, don't build on it; moves money). Sends a payment request for this order to a Square Terminal device; the customer pays on the device.
- [Check a pending card payment (not usable)](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-gateway-polling.md): `POST /v2/api/store/{team_slug}/v2/sales_order/poll_pending_payment` (internal: built for YoPrint's own apps, don't build on it). Meant to check a pending card payment from Charge a card (with its `poll_token`).
- [Prepare a card payment](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-gateway-pre-execute.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_gateway}/pre_execute` (internal: built for YoPrint's own apps, don't build on it). Card payments run through the team's connected payment gateway and charge real money.
- [Charge a card through the payment gateway](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-gateway-execute.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_reference}` (internal: built for YoPrint's own apps, don't build on it; moves money). Card payments run through the team's connected payment gateway and charge real money.
- [Cancel a Square Terminal checkout](https://developer.yoprint.com/reference/payments/v2-sales-order-payment-square-terminal-cancel.md): `PATCH /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/square_terminal/{checkout_id}/cancel` (internal: built for YoPrint's own apps, don't build on it). Cancels a Square Terminal checkout that is still waiting.
