Tokenization form process
To consider
To use the card tokenization form, the following aspects should be considered:
- The form is available at:
- Sandbox: http://sandbox-tokenizeform.greenpay.me/
- Producción: https://tokenizeform.greenpay.me/
- 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.
- The card tokenization form is only available for web apps.
After receiving the tokenization order response (session and token), redirect to the tokenization form from the merchant site, this way:
- Generate the session and token in sandbox or live according to the environment.
- Create de url, this way:
- Sandbox: http://sandbox-tokenizeform.greenpay.me/{{session}}
- 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);
}
catch (err) {
res.send(err);
}
});
When the redirection is done, the following form have to appear.
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.
- {
- "status": 201,
- "requestId": 1,
- "result": {
- "token": "fb3d1a7b-9cb1-45b7-b49d-b2a3efd98371",
- "last_digits": "7777",
- "bin": "477777"
- },
- "expiration_date": "2109",
- "brand": "Visa",
- "nickname": "Visa",
- "errors": [],
- "callback": "http://localhost:3000/callback",
- "_signature": "5005b0d596e607825ea4385d....f60c35bbbd9dcd44431100"
- }
3. Charge a card token
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 ...