Closed ollyde closed 4 years ago
There's lots of unknowns and very confusing implementations of the API.
For example, what is this strange way to get the customer API version:
CustomerSession.init((apiVersion) => server.getEphemeralKeyFromServer(apiVersion)); // or, to manage your own instances final session = CustomerSession((apiVersion) => server.getEphemeralKeyFromServer(apiVersion))
It's not clear what sort of json the server is suppose to return or what these functions are suppose to do.
Why can't it be
CustomerSession.init('some string')
much easier to understand and implement.Keep it simple.
Hey, we meet again on the other side of Github, haha.
Anyways, this is a singleton way of initializing the CustomerSession instance with the api version which is by default 2020-08-27. You're basically grabbing the ephemeral key from your server and initializing the session to create a checkout payment.
The reason it is not CustomerSession.init('some string') is because CustomerSession returns a Future
I will try to pull a request for this later and will try to show an example on how to work with this SDK using a simple Node.js server as many people seem to be confused by some aspect of its implementation.
@eyoeldefare haha yah I should delete this :-D
There's lots of unknowns and very confusing implementations of the API.
For example, what is this strange way to get the customer API version:
It's not clear what sort of json the server is suppose to return or what these functions are suppose to do.
Why can't it be
CustomerSession.init('some string')
much easier to understand and implement.Keep it simple.