Documentación API

Summary

/*! elementor - v3.11.2 - 22-02-2023 */ .elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap { background-color: #818a91; color: #fff } .elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap { color: #818a91; border: 3px solid; background-color: transparent } .elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap { margin-top: 8px } .elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter { width: 1em; height: 1em } .elementor-widget-text-editor .elementor-drop-cap { float: left; text-align: center; line-height: 1; font-size: 50px } .elementor-widget-text-editor .elementor-drop-cap-letter { display: inline-block } 

This manual’s purpose is to instruct on how to integrate an application against our API REST. First, to do this, we have to configurate certain information or data in the Zest application, after that, we must create (or build) a URL with which we can use this service, for that the app user’s Api Key will be necessary.

Additionally, if we want our integrated application to have all the information about transactions, it will be necessary to create two Web services, one for payments and another one for refunds.

Any knight have a very done workable and doing it as a very wonderfull done and subscriptions dejamos elcontenido de los usuarios que quieran suscribirse: en cuanto paguen deberían

 

User keys

Each API user has two keys, an API access key (apiKey) and another private and secret key (secretKey) that will be used to sign the requests. This second key is private, non-transferable and will not travel in requests to the API.

  • secretKey

Summary: Key for signing request to API

Example: 6629a8bbe29524bb57f15956b194cc2a35eefa503287ddeeb4c73d1e63622300bebbe844e1b64209

  • apiKey

Descripción: Key for users access

Example: 67B2298C03E39C365D47

 

API request table

All requests to the API conform to a particular format, must provide mandatory parameters in the header, and must be signed following an encryption algorithm. In order to continue, it is explained in detail:

Required parameters in the header of all requests:

/*! elementor - v3.11.2 - 22-02-2023 */ .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tabs-wrapper { width: 25%; flex-shrink: 0 } .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tab-desktop-title.elementor-active { border-right-style: none } .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tab-desktop-title.elementor-active:after, .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tab-desktop-title.elementor-active:before { height: 999em; width: 0; right: 0; border-right-style: solid } .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tab-desktop-title.elementor-active:before { top: 0; transform: translateY(-100%) } .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tab-desktop-title.elementor-active:after { top: 100% } .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-desktop-title { display: table-cell } .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-desktop-title.elementor-active { border-bottom-style: none } .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-desktop-title.elementor-active:after, .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-desktop-title.elementor-active:before { bottom: 0; height: 0; width: 999em; border-bottom-style: solid } .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-desktop-title.elementor-active:before { right: 100% } .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-desktop-title.elementor-active:after { left: 100% } .elementor-widget-tabs .elementor-tab-content, .elementor-widget-tabs .elementor-tab-title, .elementor-widget-tabs .elementor-tab-title:after, .elementor-widget-tabs .elementor-tab-title:before, .elementor-widget-tabs .elementor-tabs-content-wrapper { border: 1px #d4d4d4 } .elementor-widget-tabs .elementor-tabs { text-align: left } .elementor-widget-tabs .elementor-tabs-wrapper { overflow: hidden } .elementor-widget-tabs .elementor-tab-title { cursor: pointer; outline: var(--focus-outline, none) } .elementor-widget-tabs .elementor-tab-desktop-title { position: relative; padding: 20px 25px; font-weight: 700; line-height: 1; border: solid transparent } .elementor-widget-tabs .elementor-tab-desktop-title.elementor-active { border-color: #d4d4d4 } .elementor-widget-tabs .elementor-tab-desktop-title.elementor-active:after, .elementor-widget-tabs .elementor-tab-desktop-title.elementor-active:before { display: block; content: ""; position: absolute } .elementor-widget-tabs .elementor-tab-desktop-title:focus-visible { border: 1px solid #000 } .elementor-widget-tabs .elementor-tab-mobile-title { padding: 10px; cursor: pointer } .elementor-widget-tabs .elementor-tab-content { padding: 20px; display: none } @media (max-width:767px) { .elementor-tabs .elementor-tab-content, .elementor-tabs .elementor-tab-title { border-style: solid solid none } .elementor-tabs .elementor-tabs-wrapper { display: none } .elementor-tabs .elementor-tabs-content-wrapper { border-bottom-style: solid } .elementor-tabs .elementor-tab-content { padding: 10px } } @media (min-width:768px) { .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tabs { display: flex } .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tabs-wrapper { flex-direction: column } .elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tabs-content-wrapper { flex-grow: 1; border-style: solid solid solid none } .elementor-widget-tabs.elementor-tabs-view-horizontal .elementor-tab-content { border-style: none solid solid } .elementor-widget-tabs.elementor-tabs-alignment-center .elementor-tabs-wrapper, .elementor-widget-tabs.elementor-tabs-alignment-end .elementor-tabs-wrapper, .elementor-widget-tabs.elementor-tabs-alignment-stretch .elementor-tabs-wrapper { display: flex } .elementor-widget-tabs.elementor-tabs-alignment-center .elementor-tabs-wrapper { justify-content: center } .elementor-widget-tabs.elementor-tabs-alignment-end .elementor-tabs-wrapper { justify-content: flex-end } .elementor-widget-tabs.elementor-tabs-alignment-stretch.elementor-tabs-view-horizontal .elementor-tab-title { width: 100% } .elementor-widget-tabs.elementor-tabs-alignment-stretch.elementor-tabs-view-vertical .elementor-tab-title { height: 100% } .elementor-tabs .elementor-tab-mobile-title { display: none } } 

* apiKey

* salt

* signature

* apiKey

Data type: string

Description: User key access

Example: 7E1D9BF9A76BA0782452

* salt

Data type: string (maximun 10 caharacters)

Description: Cheksun chain

Example: jrewgbfemz

* signature

Data type: string

Description: Signature of the petition

Example: QwMDUwNDRkMTI0NTJiYjU5YTNmNGNkYTdkMDI5Y2I1MDFkZGJkN2YwYWJjOWRlZDBiYWZkZA==

 

Constructing API request

Signature calculation:

As shown in the table in the «API Requests Table» section it is necessary to pass the signature parameter with the signature of the request. The steps to sign are:

  • Construct the string to sign

String msg = serviceName + salt + apiKey + secretKey + bodyStr;

serviceName: The name of the service being called.

salt: String (Random string of maximun 10 characters).

apiKey: User key access.

secrectKey: Private user key.

body: Body of the request. – Empty string will be passed if thereis no body. Alseo, the body cannot have white space.

Once built to the previous string, the HMACSHA256 algorithm is used to encrypt it. The signature is the result of base64 encoding the result of encryption. JAVA code example.

Then as an example, the generation of a signature for the API is encoded in JAVA.

  • Ejemplo de código Java

A continuación, a modo de ejemplo, se codifica en JAVA la generación de una firma para la API.

String msg = serviceName + salt + apiKey + secretKey + body;

String algorithm = «HmacSHA256»;

String StrhashCode = hmacDigest(msg, secretKey, algorithm);

String signature= base64. getEncoder(). encodeToString(StrhashCode.getBytes());

private static String hmacDigest(String msg, String secretKey,String algoritmo){

 

String digest = null;

try {

SecretKeySpec key = new SecretKeySpec((secretKey).getBytes(«ASCII»), algoritmo);

Mac mac = Mac. getInstance(algorithm);

mac.init(key);

 

byte[]bytes = mac.doFinal(msg.getBytes(«ASCII»));

StringBuffer hash = new StringBuffer();

for (int i = 0; i < bytes. length; i++) {

String hex = Integer. toHexString(0xFF & bytes[i]);

if (hex.length() == 1) {

hash.append(‘0’);

}

hash.append(hex);

}

digest = hash.toString();

} catch (UnsupportedEncodingException e){

System. out.println(«hmacDigest UnsupportedEncodingException»);

}

catch (InvalidKeyException e){

System. out.println(«hmacDigest InvalidKeyException»);

}

catch (NoSuchAlgorithmException e){

System. out.println(«hmacDigest NoSuchAlgorithmException»);

}

return digest;

}

 

REST API Integration

The stepst to follow for an integration via REST will be as follows:

/*! elementor - v3.11.2 - 22-02-2023 */ .elementor-widget-image-box .elementor-image-box-content { width: 100% } @media (min-width:768px) { .elementor-widget-image-box.elementor-position-left .elementor-image-box-wrapper, .elementor-widget-image-box.elementor-position-right .elementor-image-box-wrapper { display: flex } .elementor-widget-image-box.elementor-position-right .elementor-image-box-wrapper { text-align: right; flex-direction: row-reverse } .elementor-widget-image-box.elementor-position-left .elementor-image-box-wrapper { text-align: left; flex-direction: row } .elementor-widget-image-box.elementor-position-top .elementor-image-box-img { margin: auto } .elementor-widget-image-box.elementor-vertical-align-top .elementor-image-box-wrapper { align-items: flex-start } .elementor-widget-image-box.elementor-vertical-align-middle .elementor-image-box-wrapper { align-items: center } .elementor-widget-image-box.elementor-vertical-align-bottom .elementor-image-box-wrapper { align-items: flex-end } } @media (max-width:767px) { .elementor-widget-image-box .elementor-image-box-img { margin-left: auto !important; margin-right: auto !important; margin-bottom: 15px } } .elementor-widget-image-box .elementor-image-box-img { display: inline-block } .elementor-widget-image-box .elementor-image-box-title a { color: inherit } .elementor-widget-image-box .elementor-image-box-wrapper { text-align: center } .elementor-widget-image-box .elementor-image-box-description { margin: 0 } 

CRM Landing

1

It is necessary to connect to the web using the user's credentials.

CRM

2

Once logged in, click on 'User Details' within the left side menu.

Profile

3

Then, we will see a panel like this, which shows us the main data of the user, including the API Key. Select the 'Edit' button.

Callback

4

Within the ‘Edit User’ section we will select the ‘Response Url’ field. When pressed, it will be displayed as follows.

Response

5

Response URL will be the section that will allow us to integrate with the REST API.

Callback URL: This will be the address to which transactions are sent.

Refund Callback URL: This will be the address to which refund-type transactions are sent.

We advise that depending on whether you are going to work in a production environment or not, the client should put in the commented sections the URLs correctly.

There are three buttons each with a functionality:

  • Generate API Key

This button automatically generates an Api Key and Secret Key to the user that will allow him to integrate with the REST API.

  • Test Callback

Makes a request to our application that will return a test transaction for the user to receive at the URL specified in «Callback URL».

  • Test Refund Callback

Makes a request to our application that will return a trial refund type transaction for the user to receive at the URL specified in «Refund callback URL». It is important to save the user for the changes to be effective.

 

Callback

Each time a transaction changes status, all transaction information is sent through the URL provided by the user in the «Callback URL» and «Refund Callback URL» sections.

Value

id

/*! elementor - v3.11.2 - 22-02-2023 */ .elementor-widget-divider { --divider-border-style: none; --divider-border-width: 1px; --divider-color: #2c2c2c; --divider-icon-size: 20px; --divider-element-spacing: 10px; --divider-pattern-height: 24px; --divider-pattern-size: 20px; --divider-pattern-url: none; --divider-pattern-repeat: repeat-x } .elementor-widget-divider .elementor-divider { display: flex } .elementor-widget-divider .elementor-divider__text { font-size: 15px; line-height: 1; max-width: 95% } .elementor-widget-divider .elementor-divider__element { margin: 0 var(--divider-element-spacing); flex-shrink: 0 } .elementor-widget-divider .elementor-icon { font-size: var(--divider-icon-size) } .elementor-widget-divider .elementor-divider-separator { display: flex; margin: 0; direction: ltr } .elementor-widget-divider--view-line_icon .elementor-divider-separator, .elementor-widget-divider--view-line_text .elementor-divider-separator { align-items: center } .elementor-widget-divider--view-line_icon .elementor-divider-separator:after, .elementor-widget-divider--view-line_icon .elementor-divider-separator:before, .elementor-widget-divider--view-line_text .elementor-divider-separator:after, .elementor-widget-divider--view-line_text .elementor-divider-separator:before { display: block; content: ""; border-bottom: 0; flex-grow: 1;