Get Customer Token
Request URL
POST /public/customer/payment/link
Description
When a customer clicks on the payment link to open the payment page, the first /public/customer request made is to this endpoint to retrieve a customer JSON Web Token (JWT). This customer JWT will be used in the headers of all subsequent /public/customer requests as the x-connectfi-jwtoken
value and will expire after 1 hour.
Schema
Property table for public/customer/payment/link
Property | Description | Required | Schema |
---|---|---|---|
link | link | Yes | { "type": "string" } |
Request Body
Snippet Examples
javascript
const axios = require('axios');
const data = {
"link": "2VVgSqKSCVKc9LR6YRyKqn3Thdx5Ouue1bTLcqRnrb2g5ZJQBmKTpXAlwb08MljdKW"
};
const config = {
method: 'POST',
url: '${CONNECTFI_BASE_URL}/public/customer/payment/link',
headers: {
'Content-Type': "application/json"
},
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/public/customer/payment/link" --data "{ \"link\":\"2VVgSqKSCVKc9LR6YRyKqn3Thdx5Ouue1bTLcqRnrb2g5ZJQBmKTpXAlwb08MljdKW\"}" --header "Content-Type: application/json"
Successful Response Examples
200 SUCCESSFUL RESPONSE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
REQUEST BODY
RESPONSE BODY
{
"code": "0",
"data": {
"expiresIn": 3600,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjRmlUcmFuc2FjdGlvbklkIjoiN2w3VHJMMFp1a0JRUjRINFcyZnN2VCIsImNGaVNlc3Npb25JZCI6IjN2RHNWdzczeHh6YjVwV3RIRHZSM0giLCJpYXQiOjE3MjI0MjQyMDksImV4cCI6MTcyMjQyNzgwOX0.ZF8z8Y9NtGdJdm1VvHYRNmtgnFRzmVSIMZfrUOAKqSU"
},
"requestId": "735493a04f2d11ef92543a54d404e711"
}