How Payments API Production Setting

I’m sorry I’m Japanese and I’m not good at English.

I’m testing to process payments based on the entered order
It’s been successful in the sandbox.
However, when I switched APP_ID, ACCESS_TOKEN, LOCATION_ID to the production environment, the following error was displayed when sending the payment request.

The payment is for a different location than the order.
object(Square\Models\Error)#109 (4) {
[“category”:“Square\Models\Error”:private]= “INVALID_REQUEST_ERROR”
[“code”:“Square\Models\Error”:private]= “BAD_REQUEST”
[“detail”:“Square\Models\Error”:private]= “The payment is for a different location than the order.”
[“field”:“Square\Models\Error”:private]= NULL
}

What is the cause of this error? Is this related to production settings?

Hi @jsa welcome to the forums (and your English is great)!

Can you provide a payment_id or an order_id? This error message happens when the order and payment are created on different locations, which is not possible. If you’re not passing a location_id to your CreatePayment request note that it will use the default location (if you have more than one location).

Thank you for the immediate reply.
As you pointed out, there are multiple stores in the production environment, and when I specified location_id in CreatePayment request’s setLocationId, it worked fine. It was very helpful. Thank you for your kindness.

1 Like

Hi - We are getting the same error but we checked that we are using locationID while creating payment.
'{“errors”: [{“code”: “BAD_REQUEST”,“detail”: “The payment is for a different location than the order.”,“category”: “INVALID_REQUEST_ERROR”}],“payment”: {“id”: “vrm2GbwbvwtzLNW3QhxCHAtbXuEZY”,“created_at”: “2020-12-30T18:55:21.246Z”,“updated_at”: “2020-12-30T18:55:21.655Z”,“amount_money”: “location_id”: “1BYPJT4KBZPZF”,“order_id”: “VOYtRGp2YsUY3NXzj9lGKh7eFE8YY”,“risk_evaluation”: “customer_id”: “RE64S1JMG0VA3D0M5T2F2KQ95W”,

Hi @vikramkhatri the payment is for location 1BYPJT4KBZPZF, but the order is for location 8S0EMEE9QBJS5, so it is throwing the error. They need to be for the same location.