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

source_idstring required

The ID for the source of funds for this payment. This could be a payment token generated by the Web Payments SDK for any of its supported methods, including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment that the seller received outside of Square, specify either "CASH" or "EXTERNAL". For more information, see Take Payments.

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.

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

For more information, see Idempotency.

app_fee_allocationsAppFeeAllocation[] — unresolved $ref

Details pertaining to recipients of the application fee. The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if present. If populated, an allocation must be present for every party that expects to receive a portion of the application fee, including the application developer.

delay_durationstring

The duration of time after the payment's creation when Square automatically either completes or cancels the payment depending on the delay_action field value. For more information, see Time threshold.

This parameter should be specified as a time duration, in RFC 3339 format.

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.
delay_actionstring

The action to be applied to the payment when the delay_duration has elapsed. The action must be CANCEL or COMPLETE. For more information, see Time Threshold.

Default: CANCEL

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

order_idstring

Associates a previously created order with this payment.

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 Cards API.

location_idstring

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

team_member_idstring

An optional TeamMember ID to associate 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).

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.

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

buyer_email_addressstring

The buyer's email address.

buyer_phone_numberstring

The buyer's phone number. Must follow the following format:

  1. A leading + symbol (followed by a country code)
  2. The phone number can contain spaces and the special characters ( , ) , - , and .. Alphabetical characters aren't allowed.
  3. The phone number must contain between 9 and 16 digits.
notestring

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

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.

Example request

{
  "amount_money": {
    "amount": 1000,
    "currency": "USD"
  },
  "app_fee_money": {
    "amount": 10,
    "currency": "USD"
  },
  "autocomplete": true,
  "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8",
  "idempotency_key": "7b0f3ec5-086a-4871-8f13-3c81b3875218",
  "location_id": "L88917AVBK2S5",
  "note": "Brief description",
  "reference_id": "123456",
  "source_id": "ccof:GaJGNaZa8x4OgDJn4GB"
}

Response

Success

Example response

{
  "payment": {
    "amount_money": {
      "amount": 1000,
      "currency": "USD"
    },
    "app_fee_money": {
      "amount": 10,
      "currency": "USD"
    },
    "application_details": {
      "application_id": "sq0ids-TcgftTEtKxJTRF1lCFJ9TA",
      "square_product": "ECOMMERCE_API"
    },
    "approved_money": {
      "amount": 1000,
      "currency": "USD"
    },
    "card_details": {
      "auth_result_code": "vNEn2f",
      "avs_status": "AVS_ACCEPTED",
      "card": {
        "bin": "411111",
        "card_brand": "VISA",
        "card_type": "DEBIT",
        "exp_month": 11,
        "exp_year": 2022,
        "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ",
        "last_4": "1111",
        "prepaid_type": "NOT_PREPAID"
      },
      "card_payment_timeline": {
        "authorized_at": "2021-10-13T21:14:29.732Z",
        "captured_at": "2021-10-13T21:14:30.504Z"
      },
      "cvv_status": "CVV_ACCEPTED",
      "entry_method": "ON_FILE",
      "statement_description": "SQ *EXAMPLE TEST GOSQ.C",
      "status": "CAPTURED"
    },
    "created_at": "2021-10-13T21:14:29.577Z",
    "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8",
    "delay_action": "CANCEL",
    "delay_duration": "PT168H",
    "delayed_until": "2021-10-20T21:14:29.577Z",
    "id": "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY",
    "location_id": "L88917AVBK2S5",
    "note": "Brief Description",
    "order_id": "pRsjRTgFWATl7so6DxdKBJa7ssbZY",
    "receipt_number": "R2B3",
    "receipt_url": "https://squareup.com/receipt/preview/EXAMPLE_RECEIPT_ID",
    "reference_id": "123456",
    "risk_evaluation": {
      "created_at": "2021-10-13T21:14:30.423Z",
      "risk_level": "NORMAL"
    },
    "source_type": "CARD",
    "status": "COMPLETED",
    "total_money": {
      "amount": 1000,
      "currency": "USD"
    },
    "updated_at": "2021-10-13T21:14:30.504Z",
    "version_token": "TPtNEOBOa6Qq6E3C3IjckSVOM6b3hMbfhjvTxHBQUsB6o"
  }
}

Changes