By default, the Reader SDK immediately captures all card payments in a transaction, but the SDK also supports the delayed capture of card payments. For example, when a customer makes an in-store purchase from a seller, the seller might want to authorize funds at the time of purchase and capture the funds when the item ships from the warehouse. The CheckoutManagerCheckoutManager can be configured to delay the capture of all card payments in a transaction.
Card payments are authorized by the issuing bank at the moment of purchase. An authorized transaction means that the bank has put a hold on the funds but the seller hasn't received the payment. Customers see this as a pending transaction on their credit card statement. At some later point, transactions are reconciled by capturing the transaction.
A captured transaction means that the seller receives the funds previously put on hold by the issuing bank.
You need to configure your Android projectconfigure your Android project to use the Reader SDK.
To delay the capture of all card payments in a transaction, set delayCapture
to true
on the CheckoutParameters.Builder
instance used to configure the checkout flow.
Important
Setting delayCapture
to true
skips the receipt, tipping, and signature screens and the following parameters are ignored: tipSettings
, skipReceipt
, and collectSignature
.
CheckoutParameters checkoutParameters =
CheckoutParameters.newBuilder(new Money(100, USD))
.delayCapture(true)
.build();
CheckoutManager checkoutManager = ReaderSdk.checkoutManager();
checkoutManager.startCheckoutActivity(this, checkoutParameters);
2. Get the transaction ID and location ID of a delayed capture transaction
After the checkout completes successfully, you can call the CaptureTransactionCaptureTransaction Square Connect endpoint from your backend to capture all card payments in the transaction. To do that, you need to get the transaction ID and location ID from the checkout result and then send those values to your backend.
Important
Square automatically cancels a transaction if it's not captured within 36 hours of its creation.
The CaptureTransactionCaptureTransaction endpoint requires a Square transaction ID and location ID. The Reader SDK returns both for any successful checkout that contains card payments.
Delayed transactions cannot be voided with the VoidTransactionVoidTransaction endpoint.
private CheckoutManager checkoutManager;
private CallbackReference checkoutCallbackRef;
...
checkoutManager = ReaderSdk.checkoutManager();
checkoutCallbackRef = checkoutManager.addCheckoutActivityCallback(result -> {
if (result.isSuccess()) {
CheckoutResult checkoutResult = result.getSuccessValue();
String transactionId = checkoutResult.getTransactionId();
String locationId = checkoutResult.getLocationId();
} else {
}
});
You cannot capture a delayed transaction with the Reader SDK. Transactions are captured using the Transactions APITransactions API on a backend service. If you haven't already added transaction capture logic to your backend service, you need to do so before you capture delayed transactions.