Cancel or Complete Payments
Learn to complete and cancel payment using the payment ID and idempotency key.
The possible statuses of payments are APPROVED
, COMPLETED
, CANCELED
, or FAILED
. Let’s try to understand the workflow of Square payments:
-
COMPLETED
: If theautocomplete
field is set totrue
in theCreatePayment
request, the payment is processed immediately, and the resultingPayment
object has thestatus
field set toCOMPLETED
. This is also the default behavior. It means that if theautocomplete
field is not set, the payment is set to complete immediately after they are created. -
APPROVED
: If theautocomplete
field is set tofalse
in theCreatePayment
request, the resultingPayment
object has a status set toAPPROVED
, which means that we’ve only requested the payment authorization. We then have the following two options:-
COMPLETED
: Complete the payment by callingCompletePayment
, which changes thestatus
toCOMPLETED
. -
CANCELED
: Cancel the payment by callingCancelPayment
, which changes thestatus
toCANCELED
.
-
-
FAILED
: If Square is unable to get the requested funds, the status is set toFAILED
.
Get hands-on with 1400+ tech skills courses.