Issue with invoice and Payment Api

I’m currently working with the Square API. My workflow is as follows:

  1. Create an orderPOST /v2/orders
  2. Receive an invoice via the invoice.created webhookPOST /v2/invoices
  3. Process paymentPOST /v2/payments

However, when I attempt to process the payment, I receive the following error:

“The order PAUGKMfQpSNtEzRjVh9byUN53sOZY is owned by another application.”

:magnifying_glass_tilted_left: Additional Context

  • I am using the same Square account, same API key, and same application credentials across all requests.
  • Despite that, Square reports that the order belongs to another application.

: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:

Additional Documentation

https://developer.squareup.com/docs/invoices-api/overview
Configure the Order-Ahead Sample Application
Develop for Japan

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 error message “The order PAUGKMfQpSNtEzRjVh9byUN53sOZY is owned by another application” typically indicates that the order was created by a different application than the one attempting to process the payment. This can happen if the order was created using a different set of application credentials or if there was a mix-up in the environment (e.g., using Sandbox credentials in a production environment or vice versa).

Here are a few steps to troubleshoot and resolve this issue:

  1. Verify Credentials: Double-check that you are using the correct API credentials (access token and application ID) for all API requests. Ensure that these credentials match the environment (Sandbox or Production) you are working in.

  2. Consistent Environment: Ensure that all API requests are being made in the same environment. If you created the order in the Sandbox, make sure the payment request is also being made in the Sandbox, and similarly for Production.

  3. Check Application Ownership: Confirm that the order was indeed created by the same application. You can do this by checking the application ID associated with the order creation request.

  4. Review Webhook Configuration: Ensure that the webhook endpoint receiving the invoice.created event is configured for the same application that created the order.

  5. Cross-Check Order ID: Verify that the order ID being used in the payment request is the correct one and matches the order created by your application.

If after these checks the issue persists, it might be helpful to review the logs in the Square Developer Dashboard to see if there are any discrepancies in the application IDs or environments used.

This answer was reviewed by @Bryan-Square.