Skip to content

Latest commit

 

History

History
107 lines (84 loc) · 3.48 KB

TokensApi.md

File metadata and controls

107 lines (84 loc) · 3.48 KB

Conekta.net.Api.TokensApi

All URIs are relative to https://api.conekta.io

Method HTTP request Description
CreateToken POST /tokens Create Token

CreateToken

TokenResponse CreateToken (Token token, string acceptLanguage = null)

Create Token

Generate a payment token, to associate it with a card

Example

using System.Collections.Generic;
using System.Diagnostics;
using Conekta.net.Api;
using Conekta.net.Client;
using Conekta.net.Model;

namespace Example
{
    public class CreateTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.conekta.io";
            // Configure Bearer token for authorization: bearerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new TokensApi(config);
            var token = new Token(); // Token | requested field for token
            var acceptLanguage = es;  // string | Use for knowing which language to use (optional)  (default to es)

            try
            {
                // Create Token
                TokenResponse result = apiInstance.CreateToken(token, acceptLanguage);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling TokensApi.CreateToken: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateTokenWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Token
    ApiResponse<TokenResponse> response = apiInstance.CreateTokenWithHttpInfo(token, acceptLanguage);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling TokensApi.CreateTokenWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
token Token requested field for token
acceptLanguage string Use for knowing which language to use [optional] [default to es]

Return type

TokenResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/vnd.conekta-v2.1.0+json

HTTP response details

Status code Description Response headers
200 successful operation * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
401 authentication error -
422 parameter validation error -
500 internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]