Skip to content

Latest commit

 

History

History
242 lines (156 loc) · 12 KB

TransactionsApi.md

File metadata and controls

242 lines (156 loc) · 12 KB

{{classname}}

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

CaptureTransaction

CaptureTransactionResponse CaptureTransaction(ctx, locationId, 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.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
locationId string
transactionId string

Return type

CaptureTransactionResponse

Authorization

oauth2

HTTP request headers

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

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

Charge

ChargeResponse Charge(ctx, body, locationId) 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 eCommerce 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.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body ChargeRequest An object containing the fields to POST for the request.

See the corresponding object definition for field details. | locationId | string| The ID of the location to associate the created transaction with. |

Return type

ChargeResponse

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]

CreateRefund

CreateRefundResponse CreateRefund(ctx, body, locationId, transactionId) CreateRefund

Initiates a refund for a previously charged tender. You must issue a refund within 120 days of the associated payment. See this article for more information on refund behavior. NOTE: Card-present transactions with Interac credit cards cannot be refunded using the Connect API. Interac transactions must refunded in-person (e.g., dipping the card using POS app).

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body CreateRefundRequest An object containing the fields to POST for the request.

See the corresponding object definition for field details. | 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. |

Return type

CreateRefundResponse

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]

ListRefunds

ListRefundsResponse ListRefunds(ctx, locationId, optional) ListRefunds

Lists refunds for one of a business's locations. In addition to full or partial tender refunds processed through Square APIs, refunds may result from itemized returns or exchanges through Square's Point of Sale applications. Refunds with a status of PENDING are not currently included in this endpoint's response. Max results per page: 50

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
locationId string The ID of the location to list refunds for.
optional *TransactionsApiListRefundsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a TransactionsApiListRefundsOpts struct

Name Type Description Notes

beginTime | optional.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. | endTime | optional.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. | sortOrder | optional.String| The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` | cursor | optional.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. |

Return type

ListRefundsResponse

Authorization

oauth2

HTTP request headers

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

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

ListTransactions

ListTransactionsResponse ListTransactions(ctx, locationId, optional) ListTransactions

Lists transactions for a particular location. Transactions include payment information from sales and exchanges and refund information from returns and exchanges. Max results per page: 50

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
locationId string The ID of the location to list transactions for.
optional *TransactionsApiListTransactionsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a TransactionsApiListTransactionsOpts struct

Name Type Description Notes

beginTime | optional.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. | endTime | optional.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. | sortOrder | optional.String| The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` | cursor | optional.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. |

Return type

ListTransactionsResponse

Authorization

oauth2

HTTP request headers

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

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

RetrieveTransaction

RetrieveTransactionResponse RetrieveTransaction(ctx, locationId, transactionId) RetrieveTransaction

Retrieves details for a single transaction.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
locationId string The ID of the transaction's associated location.
transactionId string The ID of the transaction to retrieve.

Return type

RetrieveTransactionResponse

Authorization

oauth2

HTTP request headers

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

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

VoidTransaction

VoidTransactionResponse VoidTransaction(ctx, locationId, 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.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
locationId string
transactionId string

Return type

VoidTransactionResponse

Authorization

oauth2

HTTP request headers

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

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