A link is created by calling the /secure-hosted-checkout/v1/links endpoint.
The endpoint is RESTful and will accept a JSON object with the following properties:
amount
When set to true an amount field will be displayed. The default is false
avs
Display the address and postal code fields.
Valid values are address, postal, and both. The default is none.
description
A short description of the purpose of the link.
Maximum number of characters is 60.
email
When set to true an e-mail field will be displayed.
The default value is false.
expires
The date and time the link is set to expire in ISO-8601 format (i.e. YYYY-MM-DDTHH:MM:SS.000Z).
The default value is 5 minutes into the future.
invoiceNumber
an invoice number, maximum 25 characters long.
language
The language to display the default labels and button in.
Valid values are en for English and fr for French.
The default is en.
purchaseAmount
If the transaction is a purchase or a preauthorization then the purchase amount is mandatory.
The amount given must be in lowest ordinal format (i.e. one dollar is passed in as 100.)
transactionType
The type of transaction to be performed.
Valid values are PREAUTHORIZATION, PURCHASE, and VERIFY.
This field is mandatory.
uses
The number of times a link can be used.
The default is 1.
const endpoint = 'https://shc.titan.uat.ca.payfacto.cloud/secure-hosted-checkout/v1/links'; const payload = { method: 'POST', headers: { Authorization: 'Basic key_provided_by_payfato', 'Content-Type': 'application/json; charset=utf-8', Accept: 'application/json' }, body: JSON.stringify({ transactionType: 'PURCHASE', purchaseAmount: 1025 }) }; fetch(endpoint, payload) .then(response => {console.log(response.status); return response.json()}) .then(data => console.log(data)) .catch(error => console.error(error));
{
"id": "59e36fcb-ff9d-48be-972e-8960a4c8d4ac",
"username": "v1fr7HMWgDRciXFknRtMtdlw",
"description": null,
"expires": "2024-11-04T14:34:14.667Z",
"uses": "1",
"usesUsed": "0",
"purchaseAmount": 1025,
"transactionType": "PURCHASE",
"linkUrl": "https://shc.titan.uat.ca.payfacto.cloud/secure-hosted-checkout/secure-hosted-checkout/v1/browser/hosted-pages?link=59e36fcb-ff9d-48be-972e-8960a4c8d4ac"
}
usesUsed
linkUrl linkUrl can be embedded into any another media, such as an e-mail. SPL provides several additional endpoints to assist in the care and management of a link. These are:
/links/{linkId}
Use HTTP GET to retrieve a copy of an existing link.
The properties returned are the same as those for link creation.
/links/{linkId}/cancel
Use HTTP POST to expire a link.
No body is required.
/browser/links/{linkId}/url
Use HTTP GET to retrieve the link to the hosted page as a URL.
This URL can be embedded into an HTML page or a browser
/browser/links/{linkId}/qrcode
Use HTTP GET to retrieve the link to the hosted page as a QR Code.
This URL can be embedded into an HTML page or a browser