Tokenization form process

Tokenization form process

To consider

To use the card tokenization form, the following aspects should be considered:
  1. The form is available at:
    1. Sandbox: http://sandbox-tokenizeform.greenpay.me/
    2. Producción: https://tokenizeform.greenpay.me/
  2. Get a session and token of a valid tokenization order (A session and token is valid within 30 minutes from the creation of the order) and include de callback param. In order to create session, token and include callback, you can check this article Create a tokenization order.
  3. The card tokenization form is only available for web apps.


Step to use the card tokenization form

1. Redirect to the tokenization form

After receiving the tokenization order response (session and token), redirect to the tokenization form from the merchant site, this way:
  1. Generate the session and token in sandbox or live according to the environment.
  2. Create de url, this way:
    1. Sandbox: http://sandbox-tokenizeform.greenpay.me/{{session}}
    2. Production: https://tokenizeform.greenpay.me/{{session}}
The following is a javascript example to redirect.


const express = require("express");
const app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));

app.get("/order", async function (req, res) {
try {
const security = await postOrder(order);
//console.log(security);
console.log("https://sandbox-tokenizeform.greenpay.me"+ security.session);
res.redirect("https://sandbox-tokenizeform.greenpay.me"+ security.session);
}
catch (err) {
res.send(err);
}
});


When the redirection is done, the following form have to appear.



2. Capture form response

Once the user has completed the form fields and the data is processed, the form is going to redirect to callback URL with the answer in base64 format, this way: callbackURL/base64Response.



In the callback URL destination a function must exist to capture the base64 response and decode it. The following is a javascript example to capture the response.


app.get("/callback/:data", async function (req, res) {
try {
//get the response in base64
const data = req.params.data;

//decode the response in base64
var responsejson = Buffer.from(data, 'base64').toString();
console.log(responsejson);
res.send(JSON.parse(responsejson));
} catch (err) {
res.send(err);
}
});


The following is a response example decoded.

  1. {
  2.     "status": 201,
  3.     "requestId": 1,
  4.     "result": {
  5.         "token": "fb3d1a7b-9cb1-45b7-b49d-b2a3efd98371",
  6.         "last_digits": "7777",
  7.         "bin": "477777"
  8.     },
  9.     "expiration_date": "2109",
  10.     "brand": "Visa",
  11.     "nickname": "Visa",
  12.     "errors": [],
  13.     "callback": "http://localhost:3000/callback",
  14.     "_signature": "5005b0d596e607825ea4385d....f60c35bbbd9dcd44431100"
  15. }

3. Charge a card token

In order to charge a card token check this article.

    • Related Articles

    • API Tokenization process

      To consider To invoke the payments api, the following aspects should be considered: Use the service on the endpoints: Sandbox: https://sandbox-checkout.greenpay.me/tokenize Production: https://checkout.greenpay.me/tokenize Get a session and token of ...
    • Create tokenization order

      To consider A tokenization order is created to prepare the Greenpay API for create a token from credit or debit card data. The following aspects have to be consider for it: Use these endpoints: Sandbox: https://sandbox-merchant.greenpay.me/tokenize ...
    • Webform payment process

      To consider To use the card payment form, the following aspects should be considered: The form is available at: Sandbox: https://sandbox-checkoutform.greenpay.me/ Producción: https://checkout-form.greenpay.me/ Get a session and token of a valid ...
    • Widget payment process

      To consider Para utilizar el widget de pago de Greenpay, se debe considerar los siguiente: You must have a sandbox or production account, to obtain a sandbox account visit About sandbox or test account. The payment widget is a web element that can be ...
    • General Information

      This functionality allows you to create card tokens. Two ways are provided for this service. 1.  Directly call the API where the encrypted card information is sent. 2. Invoke the tokenization form, which is displayed in a browser window. If this form ...