Build with Transactions
This component is deprecated. See below for guidance about what to use instead.
The Payment Card Industry Data Security Standard (PCI DSS) defines important security requirements for the storage, processing, and transmission of payment card information (card numbers, cardholder names, and so on). To conform to these requirements, minimize security risk, and ensure customer privacy, NEVER store, process, or transmit payment card information or other confidential customer information.
To use the Transactions API, the following must be true:
You have a Square account enabled for payment processing. If you have not enabled payment processing on your account (or you are not sure), visit squareup.com/activation.
You are using HTTPS. HTTPS is required for all production Square API calls. HTTP calls are only supported for developing and testing on localhost.
Additionally, this guide makes the following assumptions:
You have read the introductory review of this API.
You are familiar with basic web development. If you are new to web development, you should read Getting started with the Web by Mozilla.org before continuing.
You can create and run websites on localhost or a development server. If you are new to testing web pages locally, you should read Run Local Web Servers before continuing.
To use the steps in this topic, you need:
A valid access token. You should test with Sandbox credentials whenever possible. For more information, see Access Tokens and Other Square Credentials.
An active location ID. Copy a developer account location ID from the Locations page of your Square application in the Developer Dashboard or set the Developer Dashboard to Sandbox mode and then copy a Sandbox location ID.
Set some variables with your required information.
Configure payment information with the charge amount and a test nonce.
Did you know?
Businesses located in the United States or Canada can set an
amount as low as 1 cent (
1). If located in Australia, Japan or the United Kingdom, the
amount must be a minimum of 100 cents (
You can include notes and reference IDs from other systems to make cross-referencing transaction information easier.
Call the Charge endpoint to process the payment. While Charge returns results immediately, there is a slight delay between processing the transaction and the information being available in RetreiveTransaction or ListTransactions. Transactions processed through Square APIs will only ever have a single
Tender object, but transactions processed with a Square reader may have multiple