Get Merchant Token
Request URL
POST /payment-link/merchant/get-token
Description
This endpoint will allow you (the client/platform) to request a merchant JWT to use in the current merchant session of your front-end merchant portal UI. The issued merchant JWT will expire after 1 hour and it is recommended to request a new merchant JWT approximately 55 minutes after issuing in order to update the current session token. All subsequent /public/merchant endpoint requests require the issued JWT to be passed as a header with a key of "x-connectfi-jwtoken".
Schema
Property table for payment-link/merchant/get-token
Property | Description | Required | Schema |
---|---|---|---|
cFiMerchantId | The ID of the Merchant in connectFi | Yes | { "type": "string", "pattern": "^[0-9a-zA-Z_]+$", "minLength": 1, "maxLength": 36, "$id": "common-id" } |
Request Body
Snippet Examples
javascript
const axios = require('axios');
const data = {
"cFiMerchantId": "2Bc0QW0VYJe7VhTyXXEYNQ"
};
const config = {
method: 'POST',
url: '${CONNECTFI_BASE_URL}/payment-link/merchant/get-token',
headers: {
'Content-Type': "application/json",
'x-connectfi-token': "A long random string token received from /auth/get-token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "CONNECTFI_BASE_URL/payment-link/merchant/get-token" --data "{ \"cFiMerchantId\":\"2Bc0QW0VYJe7VhTyXXEYNQ\"}" --header "Content-Type: application/json" --header "x-connectfi-token: A long random string token received from /auth/get-token request"
Successful Response Examples
200 SUCCESSFUL RESPONSE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
x-connectfi-token | A long random string token received from /auth/get-token request |
REQUEST BODY
RESPONSE BODY
{
"code": "0",
"data": {
"expiresIn": 3600,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjRmlNZXJjaGFudElkIjoiNVFlaFdMZjlRbWxKOWdoRFZHc1NkUSIsImNGaUFnZ3JlZ2F0b3JJZCI6ImV2b2x2ZSIsImlhdCI6MTcyMjM0Njc4NywiZXhwIjoxNzIyMzUwMzg3fQ.UmoYqSeGsOMvjpJW31J2aQqI9V092FvD7CEUBWYXUl4"
},
"requestId": "2fd03bc04e7911efac39cdb5e869de12"
}