Payment Form
The Form integration solution enables merchants to integrate either to the Gateway thru a secure Form avoiding a PCI-DSS Certification.
This is the quickest and simplest way to integrate allowing merchants to use 3 different payment methods (Credit Cards, Pay by Link and BLIK) using a single Form..
Besides this, Form integration offers three types of layouts to suit better the merchant needs.
Form Integration is based on three simple steps:
Prepare the Checkout
First, perform a server-to-server POST request to prepare the checkout with the required data,where you should include the payment type, amount, currency and payment methods allowed.
The JSON of your POST body, can be composed of various Complex Types:
"merchant": {
"terminalId": {{terminalId}},
"channel": "web",
"merchantTransactionId": "gp9253eg4o"
}
For more info check PayTel API Market
"transaction": {
"transactionTimestamp": "Current Date",
"description": "My transaction -> Order Order Id: gp9253eg4o",
"moto": false,
"paymentType": "PURS",
"amount": {
"value": 5,
"currency": "EUR"
},
"paymentMethod": [
"CARD",
"BLIK",
"PAY_BY_LINK"
],
"payByLink": {
"expirationDatetime": "Current Date",
"linkExpirationDatetime": "Expiration Date"
}
}
For more info check Paytel API Market
"customer": {
"customerInfo": {
"customerName": "Client Name",
"customerEmail": "client.name@hostname.pt",
"shippingAddress": {
"street1": "Rua 123",
"street2": "porta 2",
"city": "Lisboa",
"postcode": "1200-999",
"country": "PT"
},
"billingAddress": {
"street1": "Rua 123",
"street2": "porta 2",
"city": "Lisboa",
"postcode": "1200-999",
"country": "PT"
}
}
}
For more info check API Market
"recurringTransaction": {
"validityDate": "2022-09-28T17:37:31.4095147+00:00",
"amountQualifier": "DEFAULT",
"description" : "My transaction -> Order XPTO"
}
For more info check API Market
"tokenisation":{
"tokenisationRequest":{
"tokeniseCard":true
}
}
For more info check API Market
The response to a successful request is a JSON with an transactionID, which is required in the second step to create the payment form.
With the transactionID, will be present as well a formContext that will be used on teh following step
POST
/api/v1/payments
Create the payment form
To create the payment form you just need to add the following lines of HTML/Javascript to your page and populating the following variables:
<script src="/assets/js/widget.js?id={transactionID}"></script>
{formContext}
that you get in response from the firs step, a {formConfig}
and optionally
{formStyle}
<form class="paymentSPG" spg-context="{formContext}" spg-config="{formConfig}" spg-style="{formStyle}"><form>
Your transactionID , and formContext from step 1:
TransactionID :
{formConfig}
and optionally {formStyle}
are importante to being able to create the from correctly. About this two below you can find an example of each:
{ "paymentMethodList": [],
"amount": { "value": 5, "currency": "EUR" },
"language": "en",
"redirectUrl": "",
"customerData": null }
{ "transaction": {
{
"layout": 'default',
"theme": 'default',
"color": {
"primary": "",
"secondary": "",
"border": "",
"surface": "",
"header": {
"text": "",
"background": ""
},
"body": {
"text": "",
"background": ""
}
},
"font": ""
}
Get the payment status
Once the payment has been processed, the customer is redirected to your redirectUrl (defined in "spg-config"
GET {transactionID}/status
/api/v1/payments/{transactionID}/status