amzn / amzn/amazon-pay-api-sdk-php

Encountering Random The value X provided for x-amz-pay-date should not be in future

Open
#19 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
51
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm using the this dependency for a amazonPay instant checkout option. Every now and then some of the payments fail with this particular error (as mentioned in the title).
`
(
[status] => 400
[method] => PATCH
[url] => https://pay-api.amazon.eu/live/v2/checkoutSessions/e73fcfe0-9791-4a99-814a-92d102dbeca1
[headers] => Array
(
[0] => accept:application/json
[1] => authorization:AMZN-PAY-RSASSA-PSS PublicKeyId={}, SignedHeaders=accept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region, Signature={}
[2] => content-type:application/json
[3] => user-agent:amazon-pay-api-sdk-php/2.2.4 (PHP/7.3.27-9+ubuntu20.04.1+deb.sury.org+1; Linux/x86_64/5.4.0-1042-gcp)
[4] => x-amz-pay-date:20220131T094401Z
[5] => x-amz-pay-host:pay-api.amazon.eu
[6] => x-amz-pay-region:eu
)

[request] => {"webCheckoutDetails":{"checkoutResultReturnUrl":"{}"},"paymentDetails":{"paymentIntent":"Authorize","canHandlePendingAuthorization":false,"chargeAmount":{"amount":63.03,"currencyCode":"EUR"}},"merchantMetadata":{"merchantReferenceId":"ORD000000070180","merchantStoreName":"{}","noteToBuyer":"","customInformation":""}}
[response] => {"reasonCode":"InvalidHeaderValue","message":"The value 20220131T094401Z provided for x-amz-pay-date should not be in future"}
[request_id] => bb3dde4d-c33f-4452-a1cd-dc88c87395cc
[retries] => 0
[duration] => 112
)
`

I think most of the information needed is there, let me know what else I should provide.

Contributor guide

Open the contributing guide

Research direction

Start by locating where the SDK generates the x-amz-pay-date header for the PATCH checkoutSessions request, then compare that timestamp with the service and host clocks when the failure occurs. The report names no file or test; done should include an established cause, a reproducible check or regression coverage, and confirmation that valid requests no longer send a future date.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, payments
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.