-
Notifications
You must be signed in to change notification settings - Fork 5
Description
TLDR
Payment parameters do not function as intended.
- delayDuration
- delayAction
Edit: I also just found out that the payment parameter of 'note' does not function as intended. The note is not saved or shown on the square dashboard in connection to the payment like it does for payments using the payments api.
- note
Problem
According to these directions from square to store a card on file, I should charge the customer, then cancel the charge.
I have the code below that I am using. The delay duration is set to 1 hour, and the delay action is set to cancel.
After testing this code in sandbox, I looked to my payments by using the list payments endpoint. I have included the matching payment json response below. From the response json, it appears to have completed and captured payment nearly immediately according to the "card_payment_timeline" field.
Code
Using version 2025.3.0 and importing modals like this (import 'package:square_mobile_payments_sdk/src/models.dart' as square;)
square.Payment? payment = await squareSDK.startPayment(
square.PaymentParameters(
autocomplete: false,
delayDuration: 60 * 60, // 1 hour
delayAction: square.DelayAction.cancel,
amountMoney: const square.Money(
amount: 120, currencyCode: square.CurrencyCode.usd),
note: "planned cancelled payment. "
"This is used to create a new stored card for customer# ${session.customer!.customerId}",
idempotencyKey:
DateFormat("YYYYMMDD-HHMMSS").format(DateTime.now())),
square.PromptParameters(
mode: square.PromptMode.defaultMode,
additionalPaymentMethods: List.empty()));
Json reponse
{
"payments": [
{
"id": "poML7vmmlSAo7H5vvMxAAXTcWvGZY",
"created_at": "2025-06-06T20:53:42.183Z",
"updated_at": "2025-06-06T20:53:43.433Z",
"amount_money": {
"amount": 120,
"currency": "USD"
},
"status": "COMPLETED",
"delay_duration": "PT168H",
"source_type": "CARD",
"card_details": {
"status": "CAPTURED",
"card": {
"card_brand": "VISA",
"last_4": "1111",
"exp_month": 11,
"exp_year": 2025,
"fingerprint": "sq-1-_gHnYMPm-o9geEeJ4FyErgW2tAvFDYWV_ry1JbIxzwtm-bd2AS3TTbqrrmp8OwvzHg",
"card_type": "CREDIT",
"prepaid_type": "NOT_PREPAID",
"bin": "411111"
},
"entry_method": "KEYED",
"cvv_status": "CVV_ACCEPTED",
"avs_status": "AVS_ACCEPTED",
"statement_description": "SQ *DEFAULT TEST ACCOUNT",
"device_details": {
"device_id": "DEVICE_VENDOR_ID:1ADEC889-574E-4058-8B39-92FE5B65C565",
"device_name": "iPad Pro (11-inch) (4th generation)",
"device_installation_id": "DEVICE_VENDOR_ID:1ADEC889-574E-4058-8B39-92FE5B65C565"
},
"card_payment_timeline": {
"authorized_at": "2025-06-06T20:53:42.323Z",
"captured_at": "2025-06-06T20:53:42.463Z"
}
},
"location_id": "Q6AVWYVYR3JQH",
"order_id": "xeUh7HWqZ74W3rrPMed24VpS1Z4F",
"processing_fee": [
{
"effective_at": "2025-06-06T22:53:43.000Z",
"type": "INITIAL",
"amount_money": {
"amount": 19,
"currency": "USD"
}
}
],
"total_money": {
"amount": 120,
"currency": "USD"
},
"approved_money": {
"amount": 120,
"currency": "USD"
},
"receipt_number": "poML",
"receipt_url": "https://squareupsandbox.com/receipt/preview/poML7vmmlSAo7H5vvMxAAXTcWvGZY",
"delay_action": "CANCEL",
"delayed_until": "2025-06-13T20:53:42.183Z",
"device_details": {
"device_id": "DEVICE_VENDOR_ID:1ADEC889-574E-4058-8B39-92FE5B65C565",
"device_name": "iPad Pro (11-inch) (4th generation)",
"device_installation_id": "DEVICE_VENDOR_ID:1ADEC889-574E-4058-8B39-92FE5B65C565"
},
"application_details": {
"square_product": "SQUARE_POS",
"application_id": "sandbox-sq0idb-XXXXXXXXXXX"
},
"version_token": "k3VP46Svpua87NXygLB3XsUrpkRcZyRZzlOXNW1S40u6o"
}
]
}