All URIs are relative to https://connect.squareup.com
Method | HTTP request | Description |
---|---|---|
CaptureTransaction | POST /v2/locations/{location_id}/transactions/{transaction_id}/capture | CaptureTransaction |
Charge | POST /v2/locations/{location_id}/transactions | Charge |
CreateRefund | POST /v2/locations/{location_id}/transactions/{transaction_id}/refund | CreateRefund |
ListRefunds | GET /v2/locations/{location_id}/refunds | ListRefunds |
ListTransactions | GET /v2/locations/{location_id}/transactions | ListTransactions |
RetrieveTransaction | GET /v2/locations/{location_id}/transactions/{transaction_id} | RetrieveTransaction |
VoidTransaction | POST /v2/locations/{location_id}/transactions/{transaction_id}/void | VoidTransaction |
CaptureTransactionResponse CaptureTransaction (string locationId, string transactionId)
CaptureTransaction
Captures a transaction that was created with the Charge endpoint with a delay_capture
value of true
. See Delayed capture transactions for more information.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class CaptureTransactionExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string |
var transactionId = transactionId_example; // string |
try
{
// CaptureTransaction
CaptureTransactionResponse result = apiInstance.CaptureTransaction(locationId, transactionId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.CaptureTransaction: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | ||
transactionId | string |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ChargeResponse Charge (string locationId, ChargeRequest body)
Charge
Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include either: - A value for the card_nonce
parameter (to charge a card nonce generated with the SqPaymentForm
) - Values for the customer_card_id
and customer_id
parameters (to charge a customer's card on file) In order for an e-commerce payment to potentially qualify for Square chargeback protection, you must provide values for the following parameters in your request: - buyer_email_address
- At least one of billing_address
or shipping_address
When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call RetrieveTransaction. See the processing_fee_money
field of each Tender included in the transaction.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class ChargeExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string | The ID of the location to associate the created transaction with.
var body = new ChargeRequest(); // ChargeRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// Charge
ChargeResponse result = apiInstance.Charge(locationId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.Charge: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | The ID of the location to associate the created transaction with. | |
body | ChargeRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CreateRefundResponse CreateRefund (string locationId, string transactionId, CreateRefundRequest body)
CreateRefund
Initiates a refund for a previously charged tender. You must issue a refund within 120 days of the associated payment. See (this article)[https://squareup.com/help/us/en/article/5060] for more information on refund behavior.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class CreateRefundExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string | The ID of the original transaction's associated location.
var transactionId = transactionId_example; // string | The ID of the original transaction that includes the tender to refund.
var body = new CreateRefundRequest(); // CreateRefundRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// CreateRefund
CreateRefundResponse result = apiInstance.CreateRefund(locationId, transactionId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.CreateRefund: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | The ID of the original transaction's associated location. | |
transactionId | string | The ID of the original transaction that includes the tender to refund. | |
body | CreateRefundRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListRefundsResponse ListRefunds (string locationId, string beginTime = null, string endTime = null, string sortOrder = null, string cursor = null)
ListRefunds
Lists refunds for one of a business's locations. Refunds with a status
of PENDING
are not currently included in this endpoint's response. Max results per page: 50
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class ListRefundsExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string | The ID of the location to list refunds for.
var beginTime = beginTime_example; // string | The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
var endTime = endTime_example; // string | The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
var sortOrder = sortOrder_example; // string | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (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 your original query. See [Paginating results](#paginatingresults) for more information. (optional)
try
{
// ListRefunds
ListRefundsResponse result = apiInstance.ListRefunds(locationId, beginTime, endTime, sortOrder, cursor);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.ListRefunds: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | The ID of the location to list refunds for. | |
beginTime | string | The beginning of the requested reporting period, in RFC 3339 format. See Date ranges for details on date inclusivity/exclusivity. Default value: The current time minus one year. | [optional] |
endTime | string | The end of the requested reporting period, in RFC 3339 format. See Date ranges for details on date inclusivity/exclusivity. Default value: The current time. | [optional] |
sortOrder | string | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` | [optional] |
cursor | string | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See Paginating results for more information. | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListTransactionsResponse ListTransactions (string locationId, string beginTime = null, string endTime = null, string sortOrder = null, string cursor = null)
ListTransactions
Lists transactions for a particular location. Max results per page: 50
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class ListTransactionsExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string | The ID of the location to list transactions for.
var beginTime = beginTime_example; // string | The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
var endTime = endTime_example; // string | The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
var sortOrder = sortOrder_example; // string | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (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 your original query. See [Paginating results](#paginatingresults) for more information. (optional)
try
{
// ListTransactions
ListTransactionsResponse result = apiInstance.ListTransactions(locationId, beginTime, endTime, sortOrder, cursor);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.ListTransactions: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | The ID of the location to list transactions for. | |
beginTime | string | The beginning of the requested reporting period, in RFC 3339 format. See Date ranges for details on date inclusivity/exclusivity. Default value: The current time minus one year. | [optional] |
endTime | string | The end of the requested reporting period, in RFC 3339 format. See Date ranges for details on date inclusivity/exclusivity. Default value: The current time. | [optional] |
sortOrder | string | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` | [optional] |
cursor | string | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See Paginating results for more information. | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RetrieveTransactionResponse RetrieveTransaction (string locationId, string transactionId)
RetrieveTransaction
Retrieves details for a single transaction.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class RetrieveTransactionExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string | The ID of the transaction's associated location.
var transactionId = transactionId_example; // string | The ID of the transaction to retrieve.
try
{
// RetrieveTransaction
RetrieveTransactionResponse result = apiInstance.RetrieveTransaction(locationId, transactionId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.RetrieveTransaction: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | The ID of the transaction's associated location. | |
transactionId | string | The ID of the transaction to retrieve. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VoidTransactionResponse VoidTransaction (string locationId, string transactionId)
VoidTransaction
Cancels a transaction that was created with the Charge endpoint with a delay_capture
value of true
. See Delayed capture transactions for more information.
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class VoidTransactionExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new TransactionsApi();
var locationId = locationId_example; // string |
var transactionId = transactionId_example; // string |
try
{
// VoidTransaction
VoidTransactionResponse result = apiInstance.VoidTransaction(locationId, transactionId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TransactionsApi.VoidTransaction: " + e.Message );
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | string | ||
transactionId | string |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]