Android - Mobile Payment SDK - Payment Failed Error

Hi Team,

After migrating from Reader SDK 2 to the Mobile Payments SDK, I’m encountering an issue during the payment flow. The payment fails with the following details:

  • Error code: CANCELED

  • Error message: “The payment was canceled.”

The error message isn’t very descriptive, so I’m unsure how to properly debug or identify the root cause.

Could you please guide me on:

  • What typically triggers this CANCELED error?

  • Any logs or additional diagnostics I should check to narrow this down?

I’ve attached a screenshot for reference.

Thanks in advance for your help!

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

https://developer.squareup.com/docs/reader-sdk/how-it-works

Additional Documentation

https://developer.squareup.com/docs/reader-sdk/what-it-does
https://developer.squareup.com/docs/reader-sdk/quick-start/step-3
Troubleshoot In-App Payments SDK Problems

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The CANCELED error in the Mobile Payments SDK typically indicates that the payment process was interrupted or canceled by the user or the application. Here are some common triggers and steps you can take to diagnose the issue:

  1. User Action: The most straightforward cause is that the user manually canceled the payment process. Ensure that the user is aware of the payment flow and confirm that they did not cancel it intentionally.

  2. Application Flow: Check if there are any parts of your application logic that might inadvertently cancel the payment. For example, if the application navigates away from the payment screen or if the activity is closed, it might trigger a cancellation.

  3. Network Issues: Ensure that there are no network connectivity issues that might cause the payment process to be interrupted.

  4. Error Handling: Review your implementation of the PaymentManagerDelegate (iOS) or the equivalent in Android to ensure that you are correctly handling all possible states and errors during the payment process.

  5. Logs and Diagnostics:

    • Check the logs for any additional error messages or warnings that might provide more context around the cancellation.
    • Ensure that you have implemented comprehensive logging around the payment flow to capture any unexpected behavior or errors.
  6. Testing Environment: If you are testing in a sandbox environment, ensure that all test configurations are correct and that you are using valid test credentials.

By reviewing these areas, you should be able to narrow down the cause of the CANCELED error and address it accordingly. If the issue persists, consider checking for any updates or known issues with the Mobile Payments SDK that might be relevant.

This answer was reviewed by @Bryan-Square.

I encounter this error immediately after tapping a card on the contactless reader. The SDK returns a Payment Failed error with:

Error code: CANCELED
Error message: “The payment was canceled.”

I’ve confirmed that neither user action nor application flow issues are causing this.

After further debugging, I’ve observed this issue is location-specific.

What’s the location_id that was used for the payment? :slight_smile:

Hi @Bryan-Square

Please find the Location Id - LZJF710PHHX2F