2

I attempted to place an order via /rest/default/V1/carts/mine/payment-information and got the following response:

    "message": "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again."
}

How do I accept terms via API?

1
1

Please request this sample :

{
            "set_paid": false,
            "paymentMethod": {
                "method": "string",
                "extension_attributes": {"agreement_ids": ["string"]}
            },
            " billing_address": {
                "region": "string",
                "region_id": int,
                "country_id": "string",
                "street": [
                    "string"
                ],
                "postcode": "int",
                "city": "string",
                "firstname": "string",
                "lastname": "string",
                "email": "string",
                "telephone": "string",
                "same_as_billing": 1    
            }
        }

You can use the below API to get all list of conditions

[Base Url]/rest/V1/carts/licence

Also, you can refer to this docs for more information

https://devdocs.magento.com/swagger/#/checkoutPaymentInformationManagementV1/checkoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPost

2
  • Where do you get the agreement ID? Can you pull the agreements via API? – Matt Robb Apr 9 '20 at 20:02
  • I believe that is the correct URL to get the agreements, however, it is not accessible to the customer on my install. Still, thanks for the help. – Matt Robb Apr 25 '20 at 0:08
1

I had faced the same issue when Terms and Conditions were enabled from admin end. This issue/answer is for those when using Magento 2 Api and at the time of placing order you will get error message "{"message":"The order wasn't placed. First, agree to the terms and conditions, then try placing your order again."}"

To resolve this you need to pass agreement_ids in payment method to place order:

 "paymentMethod": {
                "method": "cashondelivery",
                "extension_attributes": {"agreement_ids": ["1"]}
            },

Here agreement_ids can be found from backend admin panel Admin ->Configuration->Terms and Conditons id will be mentioned over there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.