Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 2.8 KB

TokensApi.md

File metadata and controls

85 lines (60 loc) · 2.8 KB

TokensApi

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

Method HTTP request Description
createToken POST /tokens Create Token

createToken

TokenResponse createToken(token, acceptLanguage)

Create Token

Generate a payment token, to associate it with a card

Example

// Import classes:
import com.conekta.ApiClient;
import com.conekta.ApiException;
import com.conekta.Configuration;
import com.conekta.auth.*;
import com.conekta.model.*;
import com.conekta.TokensApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.conekta.io");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        TokensApi apiInstance = new TokensApi(defaultClient);
        Token token = new Token(); // Token | requested field for token
        String acceptLanguage = "es"; // String | Use for knowing which language to use
        try {
            TokenResponse result = apiInstance.createToken(token, acceptLanguage);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling TokensApi#createToken");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
token Token requested field for token
acceptLanguage String Use for knowing which language to use [optional] [default to es] [enum: es, en]

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 -