Menu

Smart form integration

We will show you the different steps involved in a standard integration of our Smart Form.

First, you have to initialize a payment request with the payment information you want and that you have collected from the client. The initialization is usually done via a php curl. You can find a PHP curl on our example site.
For reasons of readability of the information sent, our example will be done in native cURL.

Native cURL example :

curl --location --request POST 'https://test-api.centralpay.net/v2/rest/paymentRequest' \
--header 'Authorization: Basic ZG9jdGVzdDo0STlISlJUZA==' \
--form 'paymentMethod[]="TRANSACTION"' \
--form 'currency="EUR"' \
--form 'totalAmount="100000"' \
--form 'partial="false"' \
--form 'breakdown[]="{amout:100000, email:johnDoe@hotmail.com}"' \
--form 'transfer[]="{destinationWalletId:10cfe034-ba9a-457e-b13d-fc68a5bfd171, amount:100000, email:johnDoe@hotmail.com}"'

Once this Payment request is correctly initiated, we return a JSON response. The information to display the smart form is present in this response, so you must retrieve and process it in order to retrieve the endpoint(s). There are several endpoints if you initiate a payment request with several payers, and therefore several breakdowns.

Example curl response :

{
    "paymentRequestId": "4cd3c57c-a71e-4e5d-832c-46e0b30d85c6",
    "creationDate": "2021-06-10T12:34:44.386219+02:00",
    "pointOfSaleId": "cfc0b3c7-e666-4c52-b77a-96f234b873fe",
    "deadline": null,
    "linkExpirationDate": null,
    "endingDate": null,
    "scenarioId": null,
    "scenarioStartingDate": null,
    "paymentFormTemplateId": null,
    "merchantPaymentRequestId": null,
    "description": null,
    "currency": "EUR",
    "totalAmount": 100000,
    "paymentRequestStatus": "ACTIVE",
    "paymentStatus": "UNPAID",
    "createCustomer": false,
    "paymentMethods": [
        "TRANSACTION"
    ],
    "transaction": {
        "paymentRequestTransactionId": "a094ba26-d5e3-41e1-a9d4-4d88bc6f838e",
        "contractId": "71602dd0-2790-4743-877b-e72530d7576d",
        "receiptEmail": null,
        "source": "EC",
        "capture": true,
        "customAcceptanceData": {}
    },
    "installment": null,
    "subscription": null,
    "breakdowns": [
        {
            "paymentRequestBreakdownId": "d3d48c4d-50d8-46d1-ba54-720b673dcc27",
            "customerId": null,
            "lastEnteringDate": null,
            "lastPaymentAttempt": null,
            "amount": null,
            "initiator": true,
            "endpoint": "https://test-form.centralpay.net/b670bb15-c243-450c-aa2b-ea6b077231e2",
            "email": "johnDoe@hotmail.com",
            "phone": null,
            "firstName": null,
            "lastName": null,
            "entered": false,
            "paymentAttempted": false,
            "paid": false,
            "view": 0,
            "payments": []
        }
    ],
    "transfers": [
        {
            "destinationWalletId": "10cfe034-ba9a-457e-b13d-fc68a5bfd171",
            "escrowDate": null,
            "amount": 100000,
            "fee": 0,
            "merchantTransferId": null
        }
    ],
    "wireTransfer": null,
    "transferGroup": null,
    "attachments": [],
    "language": "eng",
    "redirectUrl": null,
    "closeComment": null,
    "additionalData": {}
}

Example of an endpoint :

"endpoint": "https://test-form.centralpay.net/b670bb15-c243-450c-aa2b-ea6b077231e2"

The last step is to display the smart form to your customer. You can either display the smart form in another page, or integrate it directly into your page via an iframe.

Example of iframe :

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<iframe src="https://test-form.centralpay.net/b670bb15-c243-450c-aa2b-ea6b077231e2/transaction" id="iframeForm" width="1000" height="1000"></iframe>
</body>
</html>