-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh merchantSessionKey when used multiple times #16
Comments
{ "description": "Authentication failed", "code": 1002} |
The demo code in Sage Pay documentation needs more debugging anyway - it adds an empty
The jQuery code can be wrapped up into a jQuery extension, with some parameters to cater for a wide variety of use-cases of how people want to organise their forms. |
This is being worked on in a separate demo project. The front end JS will call the server to silently get a token renewal. The server can implement its own maximum count of renewals before failing the request. |
The new drop-in JS form provided by Sage Pay has a hook for renewing the session key if it expires. |
This is a front-end requirement that is covered in the ideas of issue #49 |
Noticed this when testing with the demo code.
When trying to submit, the
sagepay.js
script catches your form submit and attempts to get a token for the card details entered. If the token cannot be fetched for any reason - invalid characters, type in CC number or date, missing CVV2 etc, then the form is not submitted to the server.Each time an attempt to get a card token is made, the
merchantSessionKey
loses of of its lives. It starts with only three lives (three attempts as use) and a lifetime period of 400 seconds. Once either of these are exceeded, SagePay responds with a 401. The scripts in the page need to recognise this, and refresh themerchantSessionKey
.Whether that refresh happens through AJAX (fetching a new value from the server) or by allowing the whole form to be submitted and re-presented with a new
merchantSessionKey
is unclear. Once the card identifier is successfully obtained, it will last for up to 400 seconds and the payment form can be submitted multiple times. The card details of the form, when represented, should probably be hidden and disabled, and shown only if the user wishes to change to a different card, or the card token has expired or been used too many times.The documentation only lists a card token (
cardIdentifier
) as lasting 400 seconds, and does not list a maximum number of times it can be used to submit the payment request. Multiple submissions may be needed to get the address details into a valid state, for example.Anyway - we need to get a better demo together that brings all these expiring tokens together and handles them appropriately.
The text was updated successfully, but these errors were encountered: