@bates-solutions/squareup API Reference - v3.2.0
    Preparing search index...

    Class RefundsService

    Refunds of Square payments

    const refund = await square.refunds.refundPayment({
    paymentId: 'PAYMENT_123',
    amountMoney: { amount: 500 }, // $5.00
    idempotencyKey: 'refund-PAYMENT_123',
    });
    Index
    • List refunds, one page at a time

      Parameters

      • Optionaloptions: ListRefundsOptions

        Filters, page size and the cursor of the page to fetch

      Returns Promise<{ cursor?: string; refunds: PaymentRefund[] }>

      One page of refunds, and the cursor of the next page if there is one

      const page1 = await square.refunds.list({ status: 'COMPLETED', limit: 50 });
      const page2 = await square.refunds.list({ status: 'COMPLETED', cursor: page1.cursor });
    • Refund all or part of a payment

      The refund starts PENDING; Square sends refund.updated when it completes or fails.

      Parameters

      Returns Promise<PaymentRefund>

      The refund

      When paymentId or idempotencyKey is missing, or the amount is not positive

      const refund = await square.refunds.refundPayment({
      paymentId: 'PAYMENT_123',
      amountMoney: { amount: 500, currency: 'USD' },
      idempotencyKey: 'refund-order-123',
      reason: 'Damaged item',
      });