v1

latestOpenAPI 3.0.0Apache 2.02026-07-142008071.1 MB
Payments

CreatePayment

Creates a payment using the provided source. You can use this endpoint to charge a card (credit/debit card or
Square gift card) or record a payment that the seller received outside of Square (cash payment from a buyer or a payment that an external entity processed on behalf of the seller).

The endpoint creates a Payment object and returns it in the response.

post/v2/payments

Request body

accept_partial_authorizationboolean

If set to true and charging a Square Gift Card, a payment might be returned with amount_money equal to less than what was requested. For example, a request for $20 when charging a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card payment. This field cannot be true when autocomplete = true.

For more information, see Partial amount with Square Gift Cards.

Default: false

autocompleteboolean

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

Default: true

buyer_email_addressstring

The buyer's email address.

customer_idstring

The Customer ID of the customer associated with the payment.

This is required if the source_id refers to a card on file created using the Customers API.

delay_durationstring

The duration of time after the payment's creation when Square automatically cancels the payment. This automatic cancellation applies only to payments that do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the delay_duration time period.

This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value of 1 minute.

Note: This feature is only supported for card payments. This parameter can only be set for a delayed capture payment (autocomplete=false).

Default:

  • Card-present payments: "PT36H" (36 hours) from the creation time.
  • Card-not-present payments: "P7D" (7 days) from the creation time.
idempotency_keystring 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

Note: The number of allowed characters might be less than the stated maximum, if multi-byte characters are used.

For more information, see Idempotency.

location_idstring

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

notestring

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

Limit 500 characters.

order_idstring

Associates a previously created order with this payment.

reference_idstring

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.

source_idstring required

The ID for the source of funds for this payment. This can be a payment token (card nonce) generated by the Square payment form or a card on file made with the Customers API. If recording a payment that the seller received outside of Square, specify either "CASH" or "EXTERNAL". For more information, see Take Payments.

statement_description_identifierstring

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

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

verification_tokenstring

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

For more information, see SCA Overview.

Example request

{
  "request_body": {
    "amount_money": {
      "amount": 200,
      "currency": "USD"
    },
    "app_fee_money": {
      "amount": 10,
      "currency": "USD"
    },
    "autocomplete": true,
    "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
    "idempotency_key": "4935a656-a929-4792-b97c-8848be85c27c",
    "location_id": "XK3DBG77NJBFX",
    "note": "Brief description",
    "reference_id": "123456",
    "source_id": "ccof:uIbfJXhXETSP197M3GB"
  }
}

Response

Success

Example response

{
  "payment": {
    "amount_money": {
      "amount": 200,
      "currency": "USD"
    },
    "app_fee_money": {
      "amount": 10,
      "currency": "USD"
    },
    "approved_money": {
      "amount": 200,
      "currency": "USD"
    },
    "card_details": {
      "auth_result_code": "nsAyY2",
      "avs_status": "AVS_ACCEPTED",
      "card": {
        "bin": "411111",
        "card_brand": "VISA",
        "card_type": "DEBIT",
        "exp_month": 7,
        "exp_year": 2026,
        "fingerprint": "sq-1-TpmjbNBMFdibiIjpQI5LiRgNUBC7u1689i0TgHjnlyHEWYB7tnn-K4QbW4ttvtaqXw",
        "last_4": "1111",
        "prepaid_type": "PREPAID"
      },
      "card_payment_timeline": {
        "authorized_at": "2019-07-10T13:23:49.234Z",
        "captured_at": "2019-07-10T13:23:49.446Z"
      },
      "cvv_status": "CVV_ACCEPTED",
      "entry_method": "ON_FILE",
      "statement_description": "SQ *MY MERCHANT",
      "status": "CAPTURED"
    },
    "created_at": "2019-07-10T13:23:49.154Z",
    "customer_id": "RDX9Z4XTIZR7MRZJUXNY9HUK6I",
    "id": "GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
    "location_id": "XTI0H92143A39",
    "note": "Brief description",
    "order_id": "m2Hr8Hk8A3CTyQQ1k4ynExg92tO3",
    "receipt_number": "GQTF",
    "receipt_url": "https://squareup.com/receipt/preview/GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
    "reference_id": "123456",
    "source_type": "CARD",
    "status": "COMPLETED",
    "total_money": {
      "amount": 200,
      "currency": "USD"
    },
    "updated_at": "2019-07-10T13:23:49.446Z",
    "version_token": "H8Vnk5Z11SKcueuRti79jGpszSEsSVdhKRrSKCOzILG6o"
  }
}