Missing required parameter amount_money

Created on 31 October 2023, about 1 year ago
Updated 5 February 2024, 11 months ago

Problem/Motivation

Error creating a payment

{"errors": [@"code": "MISSING_REQUIRED_PARAMETER","detail": "Must supply amount_money","field": "amount_money","category": "INVALID_REQUEST_ERROR"]}

Steps to reproduce

Version 2023-10-20 (Latest) of the square API.

* Sandbox. The live processor does the same
* Guest
* logged in

I am confused as I was making payments prior, including with this $1 test product. I got a new server with php 8.2.


I cannot see a relevant change in the API release log.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.7

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia interlated

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @interlated
  • πŸ‡¦πŸ‡ΊAustralia interlated

    I tried

    $payment_request->setAmountMoney($square_total_money);

    Result

    {"errors": [@"code": "CARD_TOKEN_USED","detail": "Card nonce already used with a different idempotency key; please request new nonce.","category": "INVALID_REQUEST_ERROR"]}

    It appears that $payment_method->getRemoteId() does give the same remote key

  • πŸ‡¦πŸ‡ΊAustralia interlated

    This is me because I am working with the development version? I probably should repeat the following

    There are components

    - module version itself
    - Square/square library as a composer dependency
    - javascript front end

    I think there should be a requirements check and system status warning. Surface the versions loaded.

    Module - I had patched the module custom installed as an attempt to get it working php 8.2. I solved this in the end by setting 8.1 as a the php config parameter in composer.
    - I then didn't apply the 1.7 tag and got commerce/square version 1.4. Ideally not specify the version. The default seems to be 1.4. Comes with "square/connect": "^2.20190925.0" which isn't near square/square 17.2 and could be the cause of the nonce issue.

    - I ended up with an older version of the javascript loaded. drush cr didn't help with this, only toggling settings under 'performance'. So I ended up with the 'no input settings' symptom as per

    Also had 'no input settings'. Missing the drupal settings in the javascript file entirely.
    https://www.drupal.org/project/commerce_square/issues/3093086 β†’

    I'm happy to take a look at square/square v 34 integration again.

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    @interlated
    Fixed as part of this issue https://www.drupal.org/project/commerce_square/issues/3338931 πŸ“Œ Update square/square dependency in order to support PHP 8.2 Fixed .
    Please use branch 8.x-1.x for testing.

  • πŸ‡¦πŸ‡ΊAustralia interlated

    Does this PHP SDK have to match the SDK selected in the Square portal? I didn't find the documentation clear on this. I read it as "Must be greater than" and chose the latest.

    I'm not getting the latest version via composer. Seems like 8.x-1.7 - released Feb 2023. If I download I get a new version (Jan 2024?)

    version: '8.x-1.7'

    Your requirements could not be resolved to an installable set of packages.

    Problem 1
    - square/square 17.2.0.20220216 requires php >=7.2 <8.1 -> your php version (8.2; overridden via config.platform, actual: 8.2.12) does not satisfy that requirement.
    - square/square 17.3.0.20220316 requires php >=7.2 <8.2 -> your php version (8.2; overridden via config.platform, actual: 8.2.12) does not satisfy that requirement.
    - drupal/commerce_square 1.7.0 requires square/square ^17.2 -> satisfiable by square/square[17.2.0.20220216, 17.3.0.20220316].
    - Root composer.json requires drupal/commerce_square ^1.7 -> satisfiable by drupal/commerce_square[1.7.0].

    I installed it via composer file - composer.json

    "repositories": [ {
                "type": "path",
                "url": "./packages/drupal/commerce_square",
                "options": {
                    "symlink": true
                }
            },
    
    ...
    
      "require": {
            "drupal/commerce_square": "@dev",
    
    

    I'll let you know how the testing goes.

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    @interlated
    You must use branch 8.x-1.x https://www.drupal.org/project/commerce_square/releases/8.x-1.x-dev β†’ because it contains the latest changes.

Production build 0.71.5 2024