Cancel or Complete Payments
Understand how to handle payment statuses with Square API by learning to create payments with approved status, cancel payments by ID or idempotency key, and complete payments. This lesson guides you through managing payment workflows effectively in JavaScript.
The possible statuses of payments are APPROVED, COMPLETED, CANCELED, or FAILED. Let’s try to understand the workflow of Square payments:
-
COMPLETED: If theautocompletefield is set totruein theCreatePaymentrequest, the payment is processed immediately, and the resultingPaymentobject has thestatusfield set toCOMPLETED. This is also the default behavior. It means that if theautocompletefield is not set, the payment is set to complete immediately after they are created. -
APPROVED: If theautocompletefield is set tofalsein the ...