- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Using the C# SDK, is there a way to get a credit card token? Or I must make a basic HTTP call to:
https://apitest.authorize.net/xml/v1/request.api/gettoken
Thanks
VB
Solved! Go to Solution.
โ10-04-2017 07:57 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @icible,
Understood. In that thread you pointed to, the developer who responded posted some sample code that would live at /gettoken on their server, and then call https://apitest.authorize.net/xml/v1/request.api. There is no https://apitest.authorize.net/xml/v1/request.api/gettoken URL on our server.
Warning: What follows is not officially supported and can't be guaranteed to work forever
That code is essentially doing the same thing you want to do, but without an SDK. You could do the same thing in C# by writing some code to open an HTTP session to https://apitest.authorize.net/xml/v1/request.api, and POST a request for the token to that URL.
The request to the token can be formatted in XML or JSON. If you wanted to do XML, that's detailed in this thread. If you want to do JSON, like the thread you referenced, the POST would use a Content-Type: of application/json, and the actual body of the post (the request) would look something like this:
{ "securePaymentContainerRequest": { "merchantAuthentication": { "name": "{{loginId}}", "clientKey": "{{clientKey}}" }, "refId": "12345", "data": { "type": "TOKEN", "id": "{{$guid}}", "token": { "cardNumber": "4007000000027", "expirationDate": "2033-12", "cardCode": "123", "zip": "84043", "fullName": "Testy McTestcard" } } } }
As far as using the SDK to make the request for you, that's not really possible. This isn't a public part of the API, but it's what Accept.js uses to generate the token (you'd see if you stepped through all of the JavaScript code). So, no controller for this request exists in the SDK.
โ10-04-2017 02:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @icible,
Can you clarify what you mean? The word "token" gets used a lot in payments, and even in our system, so it means different things in different contexts.
Can you give more information and specify what kind of token you're looking for?
โ10-04-2017 10:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Accept.js creates a token from a credit card to later pass this token to a backend in order to make the payment.
Following this link (https://community.developer.authorize.net/t5/Ideas/Test-Opaque-Token/idc-p/59455#M452), there`s an example of how we can generate this token without using the Accept.js library. The URL provided in the link is the following, as stated in my previous message:
https://apitest.authorize.net/xml/v1/request.api/gettoken
So, in the C# sdk, is there a way to the that kind of token?
Thanks
VB
โ10-04-2017 11:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @icible,
Understood. In that thread you pointed to, the developer who responded posted some sample code that would live at /gettoken on their server, and then call https://apitest.authorize.net/xml/v1/request.api. There is no https://apitest.authorize.net/xml/v1/request.api/gettoken URL on our server.
Warning: What follows is not officially supported and can't be guaranteed to work forever
That code is essentially doing the same thing you want to do, but without an SDK. You could do the same thing in C# by writing some code to open an HTTP session to https://apitest.authorize.net/xml/v1/request.api, and POST a request for the token to that URL.
The request to the token can be formatted in XML or JSON. If you wanted to do XML, that's detailed in this thread. If you want to do JSON, like the thread you referenced, the POST would use a Content-Type: of application/json, and the actual body of the post (the request) would look something like this:
{ "securePaymentContainerRequest": { "merchantAuthentication": { "name": "{{loginId}}", "clientKey": "{{clientKey}}" }, "refId": "12345", "data": { "type": "TOKEN", "id": "{{$guid}}", "token": { "cardNumber": "4007000000027", "expirationDate": "2033-12", "cardCode": "123", "zip": "84043", "fullName": "Testy McTestcard" } } } }
As far as using the SDK to make the request for you, that's not really possible. This isn't a public part of the API, but it's what Accept.js uses to generate the token (you'd see if you stepped through all of the JavaScript code). So, no controller for this request exists in the SDK.
โ10-04-2017 02:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I misread the sample code so I thought /gettoken was part of Authorize.NET api call. Sorry for that.
But what`s funny is it works! If I issue the POST request to /xml/v1/request.api/gettoken I get a valid response... Thus I really thought it was part of your URL.
Ok then, I'll use a basic HTTP request to get a token. It`s usefull to get a token on the server side to do testing, so maybe you could consider adding it to a future version of the SDK!
Thanks for your help.
VB
โ10-05-2017 07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're absolutely right that it would be useful.
If you poke around our Ideas Forum where others can take a look, contribute feedback, and vote for new features, you'll find this particular one has been submitted. Feel free to add your voice in support of this idea there.
โ10-05-2017 07:29 AM