Skip to content

Latest commit

 

History

History
66 lines (57 loc) · 10.9 KB

create-payment-request.md

File metadata and controls

66 lines (57 loc) · 10.9 KB

Create Payment Request

Describes a request to create a payment using CreatePayment.

Structure

CreatePaymentRequest

Fields

Name Type Tags Description Getter Setter
sourceId string 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.
Constraints: Minimum Length: 1
getSourceId(): string setSourceId(string sourceId): void
idempotencyKey string 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.
Constraints: Minimum Length: 1, Maximum Length: 45
getIdempotencyKey(): string setIdempotencyKey(string idempotencyKey): void
amountMoney ?Money Optional Represents an amount of money. Money fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
Working with Monetary Amounts
for more information.
getAmountMoney(): ?Money setAmountMoney(?Money amountMoney): void
tipMoney ?Money Optional Represents an amount of money. Money fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
Working with Monetary Amounts
for more information.
getTipMoney(): ?Money setTipMoney(?Money tipMoney): void
appFeeMoney ?Money Optional Represents an amount of money. Money fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
Working with Monetary Amounts
for more information.
getAppFeeMoney(): ?Money setAppFeeMoney(?Money appFeeMoney): void
delayDuration ?string Optional 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.
getDelayDuration(): ?string setDelayDuration(?string delayDuration): void
delayAction ?string Optional 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
getDelayAction(): ?string setDelayAction(?string delayAction): void
autocomplete ?bool Optional 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
getAutocomplete(): ?bool setAutocomplete(?bool autocomplete): void
orderId ?string Optional Associates a previously created order with this payment. getOrderId(): ?string setOrderId(?string orderId): void
customerId ?string Optional 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.
getCustomerId(): ?string setCustomerId(?string customerId): void
locationId ?string Optional The location ID to associate with the payment. If not specified, the main location is
used.
getLocationId(): ?string setLocationId(?string locationId): void
teamMemberId ?string Optional An optional TeamMember ID to associate with
this payment.
getTeamMemberId(): ?string setTeamMemberId(?string teamMemberId): void
referenceId ?string Optional 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).
Constraints: Maximum Length: 40
getReferenceId(): ?string setReferenceId(?string referenceId): void
verificationToken ?string Optional 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.
getVerificationToken(): ?string setVerificationToken(?string verificationToken): void
acceptPartialAuthorization ?bool Optional 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
getAcceptPartialAuthorization(): ?bool setAcceptPartialAuthorization(?bool acceptPartialAuthorization): void
buyerEmailAddress ?string Optional The buyer's email address.
Constraints: Maximum Length: 255
getBuyerEmailAddress(): ?string setBuyerEmailAddress(?string buyerEmailAddress): void
billingAddress ?Address Optional Represents a postal address in a country.
For more information, see Working with Addresses.
getBillingAddress(): ?Address setBillingAddress(?Address billingAddress): void
shippingAddress ?Address Optional Represents a postal address in a country.
For more information, see Working with Addresses.
getShippingAddress(): ?Address setShippingAddress(?Address shippingAddress): void
note ?string Optional An optional note to be entered by the developer when creating a payment.
Constraints: Maximum Length: 500
getNote(): ?string setNote(?string note): void
statementDescriptionIdentifier ?string Optional 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.
Constraints: Maximum Length: 20
getStatementDescriptionIdentifier(): ?string setStatementDescriptionIdentifier(?string statementDescriptionIdentifier): void
cashDetails ?CashPaymentDetails Optional Stores details about a cash payment. Contains only non-confidential information. For more information, see
Take Cash Payments.
getCashDetails(): ?CashPaymentDetails setCashDetails(?CashPaymentDetails cashDetails): void
externalDetails ?ExternalPaymentDetails Optional Stores details about an external payment. Contains only non-confidential information.
For more information, see
Take External Payments.
getExternalDetails(): ?ExternalPaymentDetails setExternalDetails(?ExternalPaymentDetails externalDetails): void
customerDetails ?CustomerDetails Optional Details about the customer making the payment. getCustomerDetails(): ?CustomerDetails setCustomerDetails(?CustomerDetails customerDetails): void

Example (as JSON)

{
  "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",
  "tip_money": {
    "amount": 190,
    "currency": "ZMK"
  },
  "delay_duration": "delay_duration6",
  "delay_action": "delay_action6"
}