You are viewing an old version of the API
Create payment

Charges a payment source, for example, a card represented by customer's card on file or a card nonce

In addition to the payment source, the request must also include the amount to accept for the payment.

There are several optional parameters that you can include in the request. For example, tip money, whether to autocomplete the payment, or a reference ID to correlate this payment with another system. For more information about these payment options, see Take Payments.

The PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required to enable application fees.

Required permissions PAYMENTS_WRITE

Request Body

Name Description
amount_money
Money

Required

The amount of money to accept for this payment, not including tip_money.

Must be specified in the smallest denomination of the applicable currency. For example, US dollar amounts are specified in cents. See Working with monetary amounts for details.

The currency code must match the currency associated with the business that is accepting the payment.

idempotency_key
string

Required

A unique string that identifies this CreatePayment request. Keys can be any valid string but must be unique for every CreatePayment request.

Max: 45 characters

See Idempotency keys for more information.

Max Length 45 Min Length 1
source_id
string

Required

The ID for the source of funds for this payment. This can be a nonce generated by the Payment Form or a card on file made with the Customers API.

Min Length 1
accept_partial_authorization
boolean

Beta

If set to true and charging a Square Gift Card, a payment may be returned with amount_money equal to less than what was requested. Example, a request for $20 when charging a Square Gift Card with balance of $5 wil result in an APPROVED payment of $5. You may choose to prompt the buyer for an additional payment to cover the remainder, or cancel the gift card payment. Cannot be true when autocomplete = true.

For more information, see Partial amount with Square gift cards.

Default: false

app_fee_money
Money

The amount of money the developer is taking as a fee for facilitating the payment on behalf of the seller.

Cannot be more than 90% of the total amount of the Payment.

Must be specified in the smallest denomination of the applicable currency. For example, US dollar amounts are specified in cents. See Working with monetary amounts for details.

The currency code must match the currency associated with the business that is accepting the payment.

For more information about the application fee scenario, see
Collect Fees.

autocomplete
boolean

If set to true, this payment will be completed when possible. If set to false, this payment will be held in an approved state until either explicitly completed (captured) or canceled (voided). For more information, see Delayed Payments.

Default: true

billing_address
Address

The buyer's billing address.

buyer_email_address
string

The buyer's e-mail address

Max Length 255
customer_id
string

The ID of the customer associated with the payment. Required if the source_id refers to a card on file created using the Customers API.

location_id
string

The location ID to associate with the payment. If not specified, the default location is used.

note
string

An optional note to be entered by the developer when creating a payment

Limit 500 characters.

Max Length 500
order_id
string

Associate a previously created order with this payment

reference_id
string

A user-defined ID to associate with the payment. You can use this field to associate the payment to an entity in an external system. For example, you might specify an order ID that is generated by a third-party shopping cart.

Limit 40 characters.

Max Length 40
shipping_address
Address

The buyer's shipping address.

statement_description_identifier
string

Beta

Optional additional payment information to include on the customer's card statement as part of statement description. This can be, for example, an invoice number, ticket number, or short description that uniquely identifies the purchase.

Limit 20 characters.

Note that the statementdescriptionidentifier may get truncated on the statement description to fit the required information including the Square identifier (SQ *) and name of the merchant taking the payment.

Max Length 20
tip_money
Money

Beta

The amount designated as a tip, in addition to amount_money

Must be specified in the smallest denomination of the applicable currency. For example, US dollar amounts are specified in cents. See Working with monetary amounts for details.

The currency code must match the currency associated with the business that is accepting the payment.

verification_token
string

An identifying token generated by SqPaymentForm.verifyBuyer(). Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity.

See the SCA Overview.

Response Fields

Name Description
errors
Error [ ]

Information on errors encountered during the request.

payment
Payment

The newly created payment.

Error Descriptions

Error
ADDRESS_VERIFICATION_FAILURE

The card issuer declined the request because the postal code is invalid.

ALLOWABLE_PIN_TRIES_EXCEEDED

402 Request failed - the card has exhausted its available pin entry retries set by the card issuer. Resolving the error typically requires the card holder to contact the card issuer.

BAD_EXPIRATION

402 Request failed - the card expiration date is either missing or incorrectly formatted.

CARDHOLDER_INSUFFICIENT_PERMISSIONS

The funding source associated with the payment has limitations on how it can be used. For example, it is only valid for specific merchants or transaction types.

CARD_EXPIRED

The card issuer declined the request because the card is expired.

CARD_NOT_SUPPORTED

The card is not supported in the geographic region associated with the Square account. For example, the card is accepted in the US but not in Japan.

CHIP_INSERTION_REQUIRED

402 Request failed - the card issuer requires that the card be read using a chip reader.

CVV_FAILURE

The card issuer declined the request because the CVV value is invalid.

EXPIRATION_FAILURE

The card expiration date is either invalid or indicates that the card is expired.

GENERIC_DECLINE

The credit card was decline by the issuer for an unspecified reason.

GIFT_CARD_AVAILABLE_AMOUNT

A gift card payment was declined because the card had insufficient funds.

INSUFFICIENT_FUNDS

The funding source has insufficient funds to cover the payment.

INSUFFICIENT_PERMISSIONS

The Square account associated with the payment does not have the permissions necessary to accept the payment. For example, Square may limit which merchants are allowed to process gift card payments.

INVALID_ACCOUNT

The card issuer was not able to locate account on record.

INVALID_FEES

The total fee amount associated with the payment is too high.

INVALID_LOCATION

The associated Square account is not allowed to take payments in this region.

INVALID_PIN

The card issuer declined the request because the PIN is invalid.

INVALID_POSTAL_CODE

The postal code is improperly formatted.

MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED

The payment was declined because manually keying-in the card information is disallowed. The card must be swiped, tapped, or dipped.

PAN_FAILURE

The specified card number is invalid. For example, it is of incorrect length or is incorrectly formatted.

PAYMENT_LIMIT_EXCEEDED

Square declined the request because the payment amount exceeds the processing limit for the associated Square account.

TEMPORARY_ERROR

A temporary internal error occurred. You can safely retry your call using the same idempotency key.

TRANSACTION_LIMIT

The payment amount violates an associated transaction limit, i.e., it is too low or too high. For example, the card used is a prepaid credit card.

VOICE_FAILURE

The transaction was declined because the card issuer requires voice authorization from the cardholder.

Examples

You are viewing an old version of the API
POST /v2/payments
cURL
  • cURL
  • Ruby
  • Python
curl https://connect.squareup.com/v2/payments \
  -X POST \
  -H 'Square-Version: 2019-11-20' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -d '{
    "idempotency_key": "4935a656-a929-4792-b97c-8848be85c27c",
    "amount_money": {
      "amount": 200,
      "currency": "USD"
    },
    "source_id": "ccof:uIbfJXhXETSP197M3GB",
    "autocomplete": true,
    "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
    "location_id": "XK3DBG77NJBFX",
    "reference_id": "123456",
    "note": "Brief description",
    "app_fee_money": {
      "amount": 10,
      "currency": "USD"
    }
  }'
Response JSON
{
  "payment": {
    "id": "iqrBxAil6rmDtr7cak9g9WO8uaB",
    "created_at": "2019-07-10T13:23:49.154Z",
    "updated_at": "2019-07-10T13:23:49.446Z",
    "amount_money": {
      "amount": 200,
      "currency": "USD"
    },
    "app_fee_money": {
      "amount": 10,
      "currency": "USD"
    },
    "total_money": {
      "amount": 200,
      "currency": "USD"
    },
    "status": "COMPLETED",
    "source_type": "CARD",
    "card_details": {
      "status": "CAPTURED",
      "card": {
        "card_brand": "VISA",
        "last_4": "2796",
        "exp_month": 7,
        "exp_year": 2026,
        "fingerprint": "sq-1-TpmjbNBMFdibiIjpQI5LiRgNUBC7u1689i0TgHjnlyHEWYB7tnn-K4QbW4ttvtaqXw"
      },
      "entry_method": "ON_FILE",
      "cvv_status": "CVV_ACCEPTED",
      "avs_status": "AVS_ACCEPTED",
      "auth_result_code": "nsAyY2"
    },
    "location_id": "XK3DBG77NJBFX",
    "order_id": "qHkNOb03hMgEgoP3gyzFBDY3cg4F",
    "reference_id": "123456",
    "note": "Brief description",
    "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8"
  }
}

Share Feedback

Thanks for visiting the Square API documentation. What's on your mind?