Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Create token function #17

Open
valetzyzy opened this issue Sep 7, 2017 · 2 comments
Open

Create token function #17

valetzyzy opened this issue Sep 7, 2017 · 2 comments

Comments

@valetzyzy
Copy link

valetzyzy commented Sep 7, 2017

Please implement createToken function according to this link documentation

@trevski
Copy link

trevski commented Jun 9, 2018

+1

@trevski
Copy link

trevski commented Jun 9, 2018

I think this is already in place... but it does not seem to work.

    Dim oTokenRequest = New WorldPay.Sdk.Models.TokenRequest() With {
                                .clientKey = _ServiceKey,
                                .paymentMethod = paymentMethod,
                                .reusable = True
                            }

                            Dim authSvc As AuthService = wpClient.GetAuthService()

                            tokenResponse = authSvc.GetToken(oTokenRequest)

I needed to add the tokenURL to the appsettings

<appSettings>
  <add key="TokenUrl" value="https://api.worldpay.com/v1/tokens" />

But I am getting

System.Net.WebException: Error with request https://api.worldpay.com/v1/tokens ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream. at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.ConnectStream.WriteHeaders(Boolean async) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at Worldpay.Sdk.Http.CreateRequest(String api, RequestMethod method, Object data, Boolean authorize) in D:\HostingSpaces_objSource\ReferencedAssemblies\worldpay-lib-dotnet-master\worldpay-lib-dotnet-4-6\Worldpay.Sdk\Http.cs:line 167 --- End of inner exception stack trace --- at Worldpay.Sdk.Http.CreateRequest(String api, RequestMethod method, Object data, Boolean authorize) in D:\HostingSpaces_objSource\ReferencedAssemblies\worldpay-lib-dotnet-master\worldpay-lib-dotnet-4-6\Worldpay.Sdk\Http.cs:line 175 at Worldpay.Sdk.Http.Post[TI,TO](String api, TI item) in D:\HostingSpaces_objSource\ReferencedAssemblies\worldpay-lib-dotnet-master\worldpay-lib-dotnet-4-6\Worldpay.Sdk\Http.cs:line 87 at Worldpay.Sdk.AuthService.GetToken(TokenRequest tokenRequest) in D:\HostingSpaces_objSource\ReferencedAssemblies\worldpay-lib-dotnet-master\worldpay-lib-dotnet-4-6\Worldpay.Sdk\AuthService.cs:line 18

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants