Transactions API is DEPRECATED - Use cards saved to a Square customer profile on file to take payment using the Transactions API and Customers API.
Transactions API: Code Cookbook

Charge Cards on File Deprecated
This component is deprecated. See below for guidance about what to use instead.

Note

Transactions API is deprecated. The API functionality is split into the new Payments API and a more robust Orders API. For more information, Payments and Refunds Overview and Orders: What it Does.

PHP (5.x) (SDK)

Before you start Permalink Get a link to this section

  • You will need an access token. If you are using OAuth, you will need CUSTOMERS_WRITE permission to save a card on file and PAYMENTS_WRITE permission to process payments with the saved card. Cards on file are automatically updated on a monthly basis to confirm they are still valid and can be charged.

  • You need to have created a Customer object using the Customers API. You can follow the Customers API build guide to create your first Customer object.

  • You need to have saved a card on file for the Customer. You can follow the Save a Card on File to save a card on file.

Charge a saved card Permalink Get a link to this section

Once you have saved a card on file, you can use the Transactions API and call the Charge endpoint to process the saved card. If you are using OAuth, you will need the PAYMENTS_WRITE permission.

To charge a saved card and set the customer_card_id and customer_id fields in the ChargeRequest object instead of the card_nonce field.

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.