Search code examples
node.jssquare

Authorize payments with Square API


Currently, I am creating payments with the Square API. https://developer.squareup.com/explorer/square/payments-api/create-payment

This charges the customer's card for the desired amount. Is there a way to authorize a payment first without charging the card?

For our system, we need to wait a few minutes for a response from our vendor to process an order. I would like to authorize a payment, then if we get an approved response from our vendor, charge the customer's card otherwise cancel the payment.

I'm trying to avoid paying transaction fees, if we are unable to fulfill an order.


Solution

  • You can call CreatePayment (that you linked above) with autocomplete set to false. This will authorize the payment, but not actually take the funds out yet. By default, you have up to 6 days before the payment auto-voids, so you would want to call CompletePayment whenever you intend to complete the payment (or CancelPayment if you want to manually void the payment).