Skip to content

Update a recorded payment

Open .md

PUT/v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_reference}

v2Operation ID v2_public_sales_order_manual_payment_update

Changes a recorded payment's date, references and, for a payment recorded in YoPrint, its payment method. The amount can't change: delete the payment and record it again. {payment_reference} is the payment's id. The answer is the payment. {hash_id} is the order's id (for example V4keXwwxMQyXw7); the ord_ unique key is not accepted here.

Permission

Any member of the team.

Business rules

  • date or created_at is required; date wins.
  • Only reference_id, reference_description, the date and, on a recorded payment, payment_method_id change; other fields are ignored.
  • An amount different from the record's own is refused: 422 payment_amount_not_editable ("A payment's amount can't be edited. Remove the payment and add it again with the right amount."). Sending the same amount is fine.
  • A Customer Portal payment, or credit linked to one, can't be changed here: 422 customer_payment_source_immutable ("This credit is linked to its original customer payment and cannot be edited or deleted.").
  • Works on any other record of the order, whatever its is_editable says, and on drafts too, except records synced from an integration (Shopify): "Cannot update external object from API." On customer credit moves only reference_description changes.

Side effects

  • When a recorded payment's date, method, reference or note really changes: the change is kept in the payment's history, and on a team connected to QuickBooks the next sync writes the new date and the reference and note (as the memo) to the same QuickBooks payment. The payment method isn't sent to QuickBooks.

Path parameters

  • team_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team
  • hash_idstringrequired

    The sales order's or quote's id (a hash id). The ord_ unique key and the order number do not work here.

    • Example V4keXwwxMQyXw7
  • payment_referencestringrequired

    The payment's id (a hash id).

    • Example hAwWd7vPrqjuHD

Request body

application/json, required.

  • amountinteger

    Optional. If you send it, it must equal the record's own amount in thousandths (negative for refunds and credit moves); anything else is refused.

  • created_atstring (date)
  • datestring (date)

    The payment date (ISO 8601). Send date or created_at.

  • payment_method_idstring | null

    Recorded payments (ORDER_PAYMENT) only: one of the team's payment methods, or null to clear it. Ignored on other records.

  • A note; null clears it.

  • reference_idstring | null

    Your reference; null clears it.

Response

200Successful response.

  • dataobjectrequired

    A payment, refund or credit move. Customer Portal rows (action CUSTOMER_CHECKOUT, and credit applied from a Customer Portal payment) also carry customer_payment_checkout_id, funding_transaction_id, customer_payment_application_id, customer_payment_source_kind, is_external_cash_movement and currency_iso.

    Child fields (36)
    • amountinteger | number | string | nullrequired

      Signed: negative for DECREASE (a 25.00 refund is -25000). Thousandths, an older encoding: 12500 is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5 is 1.2345), or as a string ("1234.5") when you send X-Yoprint-Decimal-Format: exact-v1. See Money and quantities.

    • idstringrequired
    • actionstring | null

      ORDER_PAYMENT, ORDER_REFUND, ORDER_CREDIT_DEPOSIT (paid from customer credit), ORDER_CREDIT_WITHDRAW (moved to customer credit), ORDER_CREDIT_RECOVERY, ORDER_CREDIT_RESTORED, CUSTOMER_CHECKOUT (paid in the customer portal, and its refunds), CUSTOMER_CHECKOUT_CHARGEBACK (a lost dispute), or the gateway: STRIPE, SQUARE, SQUARE_V2, PAYPAL, AUTHORIZE_NET, CHARGE_IT_PRO. A REFUND_REVERSAL carries its refund's gateway.

    • credit_sourceobject | null

      Where a customer credit record came from. Always present; null on an order's records.

    • ORDER_CREDIT_RECOVERY and ORDER_CREDIT_RESTORED only: the payment the credit was issued from.

    • customer_idstring | null

      Always null on an order's records.

    • Customer Portal payment rows and credit applied from one only: the customer payment it belongs to.

    • customer_payment_sourcesarray of objects

      Customer Portal rows only: the customer payments the money came from, each with customer_payment_funding_id, funding_transaction_id, amount (a decimal string) and currency_iso.

    • datestring (date-time) | null

      When it was recorded (the payment date you sent). ISO 8601 with offset, or null.

    • Recorded payments (ORDER_PAYMENT) and card payments only: why Delete a payment or refund refuses it, or null when it can be deleted. code is credit_issued_from_payment (with amount, a decimal string) or provider_payment_not_removable; message is the refusal's text.

      Child fields (3)
    • directionstring

      INCREASE (payments, payments from customer credit, REFUND_REVERSAL, ORDER_CREDIT_RECOVERY) or DECREASE (refunds and lost disputes, moves to customer credit, card voids, ORDER_CREDIT_RESTORED).

    • Customer Portal rows only: the provider (STRIPE, PAYPAL, SQUARE_V2, AUTHORIZE_NET, CHARGE_IT_PRO) or null.

    • List and Get only, on STRIPE, PAYPAL and SQUARE_V2 card payments and Customer Portal payments: true while a dispute (or, for a Customer Portal payment, a review) is open.

    • false for card payments, Customer Portal payments, credit moves, card refunds, payments part of which moved to customer credit (and their refunds), refunds recorded against card payments, and the records YoPrint adds itself.

    • true only for recorded payments (ORDER_PAYMENT).

    • negative_credit_amountinteger | number | string | null

      Card refunds only: credit issued from the payment that the customer had already spent and the refund took back anyway, leaving their credit negative (usually 0). Thousandths, an older encoding: 12500 is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5 is 1.2345), or as a string ("1234.5") when you send X-Yoprint-Decimal-Format: exact-v1. See Money and quantities.

    • order_idstring | null
    • List and Get only, on STRIPE, PAYPAL and SQUARE_V2 card payments and direct Customer Portal payments: chargeback_open or payment_under_review while refunds and credit moves are refused, otherwise null.

    • payment_gatewaystring | null

      The gateway (STRIPE, SQUARE_V2 and so on) for card payments and refunds; for a Customer Portal payment its provider (null when unknown), and CUSTOMER_CHECKOUT or CUSTOMER_CHECKOUT_CHARGEBACK on its refunds and lost disputes; null otherwise.

    • Card payments and refunds only: Square v2's source type (for example CARD), otherwise null.

    • payment_method_idstring | null

      Refunds take their payment's; null for card payments and credit moves.

    • payment_noticesarray of objects

      List and Get only, on the same payments as has_open_hold: one notice per open dispute.

      Fields of each item (10)
    • recovery_kindstring | null

      ORDER_CREDIT_RECOVERY and ORDER_CREDIT_RESTORED only: null on an order's records.

    • reference_idstring | null
    • refundable_amountinteger | number | string | null

      Payments only: the amount minus its refunds. Money moved to customer credit is not taken off here, though a refund can't include it. 0 for refunds, credit moves, payments from customer credit, and CHARGE_IT_PRO and SQUARE card payments. Thousandths, an older encoding: 12500 is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5 is 1.2345), or as a string ("1234.5") when you send X-Yoprint-Decimal-Format: exact-v1. See Money and quantities.

    • remove_unavailableobject | null

      Recorded payments only: { "reason": "credit_issued", "amount": <thousandths> } when credit was issued from the payment, otherwise null.

    • ORDER_CREDIT_RESTORED only: the ORDER_CREDIT_RECOVERY record it gives back.

    • Card refunds and ORDER_CREDIT_RESTORED only: the REFUND_REVERSAL record when the refund failed, or null.

    • REFUND_REVERSAL only: the failed refund.

    • subtypestring

      PAYMENT, REFUND (also a lost dispute), TRANSFER (a customer credit move), ORDER_PAYMENT_VOIDED_NEG_ADJ (a voided card payment), REFUND_REVERSAL (a failed card refund given back to its payment), ORDER_CREDIT_RECOVERY (credit a refund took back) or ORDER_CREDIT_RESTORED (that credit given back when the refund failed).

    • tokenstring | null

      The gateway's charge token; null for recorded payments.

    • typestring

      MANUAL (recorded in YoPrint) or SYSTEM (card and Customer Portal payments and refunds, Shopify payments, adjustments).

    • user_idstring | null

      The team member who recorded it.

    • voidedboolean
  • statusintegerrequired
  • successbooleanrequired

Errors

  • 401The API key is missing or wrong (unauthenticated).

  • 403You are not allowed to do this. api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only {"message": "Insufficient Permission"}. Other refusals use the error envelope, with unauthorized or user_is_not_authorized.

  • 404Not found. page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. code: null, with a message that starts "No query results for": there is no record with that id.

  • 422The request was refused and changed nothing. validation_failed lists what to fix in error.fields; other codes name a business rule, explained in error.message. A few checks answer with only {"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answer connect_timeout ("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.

    When
    No date was sent, an unknown payment method, or a Shopify order deleted in Shopify (shopify_order_deleted_externally).
    Fix
    Send date.
    When
    A different amount (payment_amount_not_editable).
    Fix
    Leave amount out, or delete the payment and record it again.
    When
    A Customer Portal payment or credit linked to one (customer_payment_source_immutable).
    Fix
    Change it from the customer payment in the web app.
    When
    The record was synced from an integration such as Shopify (validation_error, "Cannot update external object from API.").
    Fix
    Change it in the integration.