Cancel or Complete Payments

Learn to complete and cancel payment using 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 the autocomplete field is set to true in the CreatePayment request, the payment is processed immediately, and the resulting Payment object has the status field set to COMPLETED. This is also the default behavior. It means that if the autocomplete field is not set, the payment is set to complete immediately after they are created.

  • APPROVED: If the autocomplete field is set to false in the CreatePayment request, the resulting Payment object has a status set to APPROVED which means that we’ve only requested the payment authorization. We then have the following two options:

    • COMPLETED: Complete the payment by calling CompletePayment which changes the status to COMPLETED.

    • CANCELED: Cancel the payment by calling CancelPayment which changes the status to CANCELED.

  • FAILED: If Square is unable to get the requested funds, the status is set to FAILED.

Get hands-on with 1400+ tech skills courses.