Square.Connect.Api.RefundsApi

November 20, 2019 ยท View on GitHub

All URIs are relative to https://connect.squareup.com

MethodHTTP requestDescription
GetPaymentRefundGET /v2/refunds/{refund_id}GetPaymentRefund
ListPaymentRefundsGET /v2/refundsListPaymentRefunds
RefundPaymentPOST /v2/refundsRefundPayment

GetPaymentRefund

GetPaymentRefundResponse GetPaymentRefund (string refundId)

GetPaymentRefund

Retrieves a specific Refund using the refund_id.

Example

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class GetPaymentRefundExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new RefundsApi();
            var refundId = refundId_example;  // string | Unique ID for the desired `PaymentRefund`.

            try
            {
                // GetPaymentRefund
                GetPaymentRefundResponse result = apiInstance.GetPaymentRefund(refundId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling RefundsApi.GetPaymentRefund: " + e.Message );
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
refundIdstringUnique ID for the desired `PaymentRefund`.

Return type

GetPaymentRefundResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListPaymentRefunds

ListPaymentRefundsResponse ListPaymentRefunds (string beginTime = null, string endTime = null, string sortOrder = null, string cursor = null, string locationId = null, string status = null, string sourceType = null)

ListPaymentRefunds

Retrieves a list of refunds for the account making the request. Max results per page: 100

Example

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class ListPaymentRefundsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new RefundsApi();
            var beginTime = beginTime_example;  // string | Timestamp for the beginning of the requested reporting period, in RFC 3339 format.  Default: The current time minus one year. (optional) 
            var endTime = endTime_example;  // string | Timestamp for the end of the requested reporting period, in RFC 3339 format.  Default: The current time. (optional) 
            var sortOrder = sortOrder_example;  // string | The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional) 
            var cursor = cursor_example;  // string | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.  See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional) 
            var locationId = locationId_example;  // string | ID of location associated with payment. (optional) 
            var status = status_example;  // string | If provided, only refunds with the given status are returned. For a list of refund status values, see `PaymentRefund`.  Default: If omitted refunds are returned regardless of status. (optional) 
            var sourceType = sourceType_example;  // string | If provided, only refunds with the given source type are returned. - `CARD` - List refunds only for payments where card was specified as payment source.  Default: If omitted refunds are returned regardless of source type. (optional) 

            try
            {
                // ListPaymentRefunds
                ListPaymentRefundsResponse result = apiInstance.ListPaymentRefunds(beginTime, endTime, sortOrder, cursor, locationId, status, sourceType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling RefundsApi.ListPaymentRefunds: " + e.Message );
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
beginTimestringTimestamp for the beginning of the requested reporting period, in RFC 3339 format. Default: The current time minus one year.[optional]
endTimestringTimestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time.[optional]
sortOrderstringThe order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default).[optional]
cursorstringA pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See Pagination for more information.[optional]
locationIdstringID of location associated with payment.[optional]
statusstringIf provided, only refunds with the given status are returned. For a list of refund status values, see `PaymentRefund`. Default: If omitted refunds are returned regardless of status.[optional]
sourceTypestringIf provided, only refunds with the given source type are returned. - `CARD` - List refunds only for payments where card was specified as payment source. Default: If omitted refunds are returned regardless of source type.[optional]

Return type

ListPaymentRefundsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RefundPayment

RefundPaymentResponse RefundPayment (RefundPaymentRequest body)

RefundPayment

Refunds a payment. You can refund the entire payment amount or a portion of it. For more information, see Payments and Refunds Overview.

Example

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class RefundPaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new RefundsApi();
            var body = new RefundPaymentRequest(); // RefundPaymentRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

            try
            {
                // RefundPayment
                RefundPaymentResponse result = apiInstance.RefundPayment(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling RefundsApi.RefundPayment: " + e.Message );
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
bodyRefundPaymentRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

RefundPaymentResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]