braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
546 stars 224 forks source link

Feature request: generate client token with expiration date #284

Closed ganboonhong closed 3 years ago

ganboonhong commented 3 years ago

General information

Issue description

When generating client token, Is it possible to pass an expiration date (absolute/relative time) as parameter to let the token to expire in desired time?

https://github.com/braintree/braintree_php/blob/b5e971d898c78819cf2fddab7043b7c7c69e841e/lib/Braintree/ClientTokenGateway.php#L38-L48

Currently, client tokens are valid for up to 24 hours according to the document.

https://developers.braintreepayments.com/guides/authorization/client-token

Use case: I'm implementing PayPal checkout. When users clicked the yellow PayPal button, a new pop-up window will come out. If users leave the window open and come back an hour later, they can still pay successfully which I don't want it to happen.

So, is it possible to prevent it from happening by specifying a shorter expiration date on the client token?

Screen Shot 2020-10-22 at 10 38 54 AM

crookedneighbor commented 3 years ago

No. You'll have to implement a client side check to timeout after inactivity and reload your page to remove the connection to PayPal.