Banking verification screens showing number in pence not GBP

I personally am unable to log in there as this belongs to the owner, I tested with a sandbox account that I have access to then handed it over to the owner.
It is odd you say one payment, A total of 4 payments have been made according to the database, if can you confirm the total for that payment I can link it to which one in the database.

$subtotal = ‘50.00’; //eg.
$delivery = ‘3.00’; //eg.

$total = sprintf(‘%0.2f’, (float)$delivery+$subtotal);

$money = new Money();
$money->setAmount($total * 100); //convert to pence

this code when tested does produce 5300 (£53 being the last payment which arrived ok)

What are the payment_ids of the other successful payments? This is what I see:

{
  "errors": [
    {
      "code": "CARD_DECLINED_VERIFICATION_REQUIRED",
      "detail": "Authorization error: 'CARD_DECLINED_VERIFICATION_REQUIRED'",
      "category": "PAYMENT_METHOD_ERROR"
    }
  ],
  "payment": {
    "id": "5CFbbb7U3Nc9KTXJoP7hXdpmUt7YY",
    "created_at": "2023-12-31T15:04:43.843Z",
    "updated_at": "2023-12-31T15:04:44.070Z",
    "amount_money": {
      "amount": 8980,
      "currency": "GBP"
    },
    "status": "FAILED",
    "delay_duration": "PT168H",
    "source_type": "CARD",
    "card_details": {
      "status": "FAILED",
      "card": {
        "card_brand": "VISA",
        "last_4": "0800",
        "exp_month": 4,
        "exp_year": 2028,
        "fingerprint": "sq-1-vvPQA5J0S40L0F2P1Qbr-Rd2hgQNZTpD7djn3zK0f-25ByaUU0dWYeysUkft1GtKQg",
        "card_type": "DEBIT",
        "prepaid_type": "NOT_PREPAID",
        "bin": "475144"
      },
      "entry_method": "KEYED",
      "cvv_status": "CVV_ACCEPTED",
      "avs_status": "AVS_NOT_CHECKED",
      "errors": [
        {
          "code": "CARD_DECLINED_VERIFICATION_REQUIRED",
          "detail": "Authorization error: 'CARD_DECLINED_VERIFICATION_REQUIRED'",
          "category": "PAYMENT_METHOD_ERROR"
        }
      ],
      "statement_description": "SQ *CARDIFF MODEL ENGINE",
      "card_payment_timeline": {
        "authorized_at": "2023-12-31T15:04:44.070Z"
      }
    },
    "location_id": "LAMKBB1NZSD9K",
    "order_id": "WXJuunHkzdDqZFy9HCb6hnAXsWSZY",
    "total_money": {
      "amount": 8980,
      "currency": "GBP"
    },
    "approved_money": {
      "amount": 0,
      "currency": "GBP"
    },
    "delay_action": "CANCEL",
    "delayed_until": "2024-01-07T15:04:43.843Z",
    "application_details": {
      "square_product": "ECOMMERCE_API",
      "application_id": "sq0idp-Q2V_lsg9g2X6lj6GA81Ljg"
    },
    "version_token": "1ZUcECLzAPjo49xur0WSq1sgFUgbgJzrynx3c8DRzSx6o"
  }
}

Also when calling verifyBuyer it expects the amount in a float. Once you get back the verification_token and call CreatePayment that’s when the amount needs to be passed in as the smallest denomination which in your case is pence. :slightly_smiling_face:

The 3 other payments, note I changed the generated ID’s by request…
CMES-WEBSITE-1695732499 (£152.00)
CMES-WEBSITE-1696014648 (£56.60)
CMES-WEBSITE-1697405818 (£145.00)

thanks for posting that, I see the amount came through as 8980 as expected

Could you provide the Square generated IDs. They’ll look similar to this nP4ty57kzx0hIiNrvv71Eym17TfZY :slightly_smiling_face:

   // Required in SCA Mandated Regions: Learn more at https://developer.squareup.com/docs/sca-overview
  async function verifyBuyer(payments, token) {
    var verificationDetails = {
      amount: '<?php echo $total * 100; ?>',
      billingContact: {
        givenName: '<?php echo $billing_first_name; ?>',
        familyName: '<?php echo $billing_last_name; ?>',
        email: '<?php echo $billing_email; ?>',
        phone: '<?php echo $billing_phone; ?>',
        addressLines: ['<?php echo $billing_address_1; ?>', '<?php echo $billing_address_2; ?>'],
        city: '<?php echo $billing_city; ?>',
        state: '<?php echo $billing_state; ?>',
        countryCode: '<?php echo $billing_country; ?>',
      },
      currencyCode: 'GBP',
      intent: 'CHARGE',
    };

I can not sorry, I do not have these in the database our end!

during testing in sandbox we were able to cross ref. these “CMES-WEBSITE-1695732499”, to the payments in the api!

Your not able to call the API to get the payment_id? Our logs that I use aren’t seeing them. That means there outside the window in which we keep the logs. If your not able to call the API to get them you’ll need to ask the owner of the account to get the Square generated IDs so we can look into this. :slightly_smiling_face:

Pass, though the payments have gone through, it was all checked being a new system.
It is a pain… The owner (the Club) has to get the sec in charge of finances to check (many people involved!)

As you can see by the code provided, float was used to create $total, and $total was passed to the verify, is this correct?

I have emailed asking for said payment_id’s though not sure when i will get a reply

lucky he was in…
Payment ID’s
zZyRgyXuovpQ006OCoC1BwTMzJOZY
PzWSteb8EqjTEj6J0cvjojD5O5LZY
1ohHBIbgYUBPFDauO8AEk1uCnjIZY
XPUVY1d5wA8qB3c8P1vUc9jmWm8YY

Great!

Okay, those are all process successfully however they’re older then 28 days which is why I wasn’t able to see them in your API Logs. :slightly_smiling_face:

Great, (phew).
Can you confirm the code I provided above is correct please?

from my understanding, if the other payments were correct then the 8980 from id 5CFbbb7U3Nc9KTXJoP7hXdpmUt7YY should also be correct, assuming that all payments pass through the verifyBuyer()

That’s correct. It appears that you are passing in the amount to CreatePayment correctly. However I mentioned that it’s different for verifyBuyer. Can you confirm how your passing in the amount for verifyBuyer? :slightly_smiling_face:

$total = sprintf(‘%0.2f’, (float)$delivery+$subtotal);

async function verifyBuyer(payments, token) {
var verificationDetails = {
amount: ‘<?php echo $total * 100; ?>’,

That’s multiplying the amount by 100. The amount needs to be a float when calling verifyBuyer. Here’s our reference. :slightly_smiling_face:

I have used the float method throughout as advised by your examples on your site. Can I assume then that the * 100 is the cause here

That’s correct. That would be why the customer see’s the wrong amount on verification but not when charged. :slightly_smiling_face:

So dropping the * 100 …

$total = sprintf(‘%0.2f’, (float)$delivery+$subtotal);

async function verifyBuyer(payments, token) {
var verificationDetails = {
amount: ‘<?php echo $total; ?>’,

this should rectify this ?

Many thanks for helping locate this issue, using pence throught the code but NOT for SCA verification should be highlighted more clearly. The whole idea of using pence struck me as rather odd in the first place, but at least we got to the bottom of this and this thread will no doubt help other’s.