[#1102] Invalid Timestamp Error on approve/cancel order

Migrated from Redmine #1102 | Author: Khurram Shaikh
Status: Feedback | Priority: High, I’m very impatient | Created: 2023-09-09


I am building custom payment processor, on response from our payment gateway I have to update order status based on payment capture status. I am calling sbpay approve api as per documentation it throws error Invalid timestamp.

I am passing sbpay timestamp comes after calling custom payment processor.

{
“timestamp”: “2023-09-09T11:39:05+00:00”,
“algo”: “sha256”,
“id”: 156,
“paymentMethod”: “Benefit”,
“transactionId”: “123456”,
“reason”: “Pay via Benefit”,
“zeroAmount”: true
}

Khurram Shaikh wrote:

Can we get early response on this. we have UAT schedule tomorrow

Dmytro Bondarev wrote:

Hello, sorry for delay.
Could you please provide RAW HTTP request and response?

Khurram Shaikh wrote:

HTTP Request:

POST https://app.sbpay.me/api/order/183/approve
X-Merchant:jenanmedical
X-Auth-Token:XXXXX528bdb76211cdebe72XXXXXXXXXXc6126aeb19480679ce1c9ca5XXXXXX
X-Signature:a4939cc3610dacd5d357f160921c5fd249b034ee275f93901ed28644ad63a8a2

{
“algo”: “sha256”,
“id”: 183,
“paymentMethod”: “Benefit”,
“transactionId”: “”,
“reason”: “Pay via Benefit”,
“zeroAmount”: true,
“timestamp”: “2023-09-09T13:44:00+00:00”
}

RESPONSE:

{
“message”: “Validation error”,
“data”: {
“errors”: [
{
“path”: “timestamp”,
“error”: “Invalid timestamp”
}
]
}
}

Dmytro Bondarev wrote:

Hi, it seems you provide not correct time.
It must be current datetime in ISO8601 format.

Khurram Shaikh wrote:

This time stamp format available in API documentation thays why I pass the same format. and I guess its not any time its should match sbpay timestamp to decode HMAC data.

Please clear the point.

Dmytro Bondarev wrote:

Hi, as I told you before it must be current datetime.

Khurram Shaikh wrote:

OK Thank I will retry in a while and update the post accordingly

Khurram Shaikh wrote:

throws the same error with ISO8601 format

Request:
{
“algo”: “sha256”,
“id”: 168,
“paymentMethod”: “Benefit”,
“transactionId”: “”,
“reason”: “Pay via Benefit”,
“zeroAmount”: true,
“timestamp”: “2023-09-09 13:38:21.000”
}

Response:

{
“message”: “Validation error”,
“data”: {
“errors”: [
{
“path”: “timestamp”,
“error”: “Invalid timestamp”
}
]
}
}

Dmytro Bondarev wrote:

Hi,

I am not sure what you mean.
Today is not 2023-09-09, today is 2023-09-11.
ISO 8601 has following format 2023-09-11T10:13:31+03:00

Khurram Shaikh wrote:

I have tried this as well 2023-09-11T10:13:31+03:00

It throws invalid timestamp.

is there anyway I can provide you full details including confidential details for. you to check whats happening with single transaction.

Dmytro Bondarev wrote:

You should use Current date and time, not some constant.
Please have a look sbpay-sdk/lib/SBPayClient.php at main · dimkasb/sbpay-sdk · GitHub here.