Payments – Hosted Payment Page (HPP) - Online Payments

Sending us payment details

So that we can process an online payment, your website needs to send an API payment request to our online payment servers to initiate the transaction.

You send us the payment transaction details in an API message. The message needs to submit a payment request to create a payment job with the details of the transaction. For a card payment, the request needs to include the card details. For a card that is enrolled for 3-D Secure version 2.2, the cardholder name is also required.

For all types of payment, we then send you a link to direct the shopper to our gateway’s 3-D Secure page. This page is where the shopper securely enters their 3-D Secure details. We carry out some 3-D Secure checks and depending on the result of the checks we either decline the transaction or accept if for payment processing.

The payment request needs to be in the form of a HTTPS POST to either our integration or production environment:

Environment - URL

Integration - https://gateway-int.cashflows.com

Production - https://gateway.cashflows.com

Tip: We recommend that you use UTF-8 for encoding before you submit.

If you need an integration account, please email techsupport@cashflows.com.

You must encrypt the message with the API key that you collected from Cashflows Go. For information, see Collect your access credentials.

You must use the same hashing technique that we do so that we can match our hash with yours. The hash assures message consistency and protects the payment request from being tampered with during transfer to our Cashflows gateway (a man-in-the-middle attack).

Your message needs to have the following headers:

ConfigurationId: xxxxx
Hash:ExampleExampleExampleExampleExampleExampleExampleExampleExample ExampleExampleExampleExampleExampleExample

The process for submitting a payment request involves the following steps. These steps are described in the sections that follow:

1.     Create a payment job.
A payment job is a server-to-server call from your server to ours. It contains the details that are required to initiate a payment request. After you have submitted the payment job, the Cashflows Gateway API returns a 201 response ‘Payment job created successfully’ (assuming that the request was successful). For information, see Create a payment job.

2.     Receive the payment job details in the response.
The API returns specific payment and order information and link to our Hosted Payment Page. For information, see Receive a response to a payment request and direct a shopper to the hosted payment page.

3.     Use the link to direct the shopper to our Hosted Payment Page where they can securely enter their card details and submit them for authorisation. For information, see Receive a response to a payment request and direct a shopper to the hosted payment page.

Note: If 3-D Secure is enabled, the Hosted Payment Page redirects the shopper to the 3-D Secure page on their bank’s website before submitting the payment.

How to create a payment job

To create a payment job, you must provide a payment job request that contains at least the mandatory parameters. To help you track payments, we recommend that you provide more than the mandatory details in the payment job. As a minimum, consider including:

·       Payment amount

·       Currency

·       Locale

·       Order reference (the reference that you generate)

·       Customer name

·       Customer email

Tip: As a starting point to establish and test connectivity, it’s good enough to provide only the mandatory information. You can then add details as required to build out the payment job request. To make it easier for you to identify a payment, we recommend that you include as much information as possible. Our API includes many more details including billing/shipping details, order line details and more. For a full list of mandatory and optional parameters, please contact our Technical Support team

To create a payment job:

1.     In the request header, provide your configuration ID and a hash.

Your configuration ID identifies your application to the gateway and is available in Cashflows Go. For information, see Collect you access credentials.

2.     Concatenate the message body to the API key to give one long string.

For example, to use an example API key like this:

845c51f6-1cd5-4338-a586-df752e65d690

To submit to the Cashflows API the following fields and values:

amountToCollect": "10.00", "currency": "GBP", "locale": "en_GB"

You would concatenate with the API key to give:

845c51f6-1cd5-4338-a586-df752e65d690{"amountToCollect": "10.00", "currency": "GBP", "locale": "en_GB" }

3.     Hash the concatenated string to give, for example:

3CDF192F6AC67E3A491EF2B60EA9A03C6B408056CE19C3BBC307EB06A4CE1F4081B8D021B1E9760E7CC18EED479EDBAFF926DADC2953B5F8B25717B8D5CB7609

Important: Every field and value that you send, and every parenthesis, must be included in the hash.

The resulting headers must match the format of this example:

ConfigurationId:201226100000131072
Hash:3CDF192F6AC67E3A491EF2B60EA9A03C6B408056CE19C3BBC307EB06A4CE1F4081B8D021B1E9760E7CC18EED479EDBAFF926DADC2953B5F8B25717B8D5CB7609
Example: Create a new payment job
POST https://gateway-int.cashflows.com/api/gateway/payment-jobs

{"amountToCollect": "10.00", "currency": "GBP", "locale": "en_GB", "order": {"orderNumber":"Your ref", "billingAddress" : {"firstName" : "Alex", "lastName" : "Smith"}, "billingIdentity": {"emailAddress": "alex@test.com"}}}

Tip: Including optional cardholder and delivery details in your payment request enables us to display this information in the gateway portal transaction search and reports. This can make it easier for you to locate payments and assist with reconciliation. The extra detail can also help our customer support team to find a payment it ever needs investigating.

Receive a response to a payment request and direct a shopper to the hosted payment page

The API receives the payment request and responds with:

·       A response code (to confirm success or otherwise) and

·       A link that points to the Hosted Payment Page where you should direct the shopper.

Here is an example with the link (action URL) highlighted.

Picture

If the request is successful, you’ll receive a 201 response. For a list of other response codes, see Response codes.

To receive the response:

1.     Extract the link (action URL) and use it to take you to the integration environment simulation page:

Picture

Tip: You can simulate a successful or a failed payment or use the test cards in the simulated live environment. For more information about testing and to find some the test card details that you can use, see Testing.

Example response

When you send a request to create a payment job in our integration environment, you receive back a response that includes a link (action URL) to the Hosted Payment Page. This is the link that you need to use to redirect the shopper so that they enter their card details or select an alternative payment method on the payment page that we are hosting for you. As soon as we have the details that we need, we can process the payment. For more information, see Processing a payment.

{"amountToCollect": "10.00", "currency": "GBP", "locale": "en_GB", "order": {"orderNumber":"Your ref", "billingAddress" : {"firstName" : "Alex", "lastName" : "Smith"}, "billingIdentity": {"emailAddress": "alex@test.com"}}}

Here is an example of the full response with the success response code included.

{

    "data": {

        "reference": "210121017238589452",

        "createDateTimeUtc": "2021-01-14T10:32:50.506892Z",

        "type": "Payment",

        "traceReference": "210120117364553808",

        "configurationId": "200426117314086912",

        "domain": "cashflows.com",

        "locale": "en_GB",

        "timeZone": "Europe/London",

        "order": {

            "orderNumber": "Your ref",

            "createDateTimeUtc": "2021-01-14T10:32:50.506894Z",

            "billingAddress": {

                "firstName": "Alex",

                "lastName": "Smith"

            },

            "billingIdentity": {

                "emailAddress": "alex@test.com"

            },

            "orderLines": []

        },

        "orderHistory": [],

        "paymentMethodsToUse": [

            "Card"

        ],

        "currency": "GBP",

"amountToCollect": "10.00",

        "expirationDateTimeUtc": "2021-07-14T10:32:50.5068906Z",

        "lastUpdateTimeUtc": "2021-01-14T10:32:50.5068934Z",

        "lastProcessedTimeUtc": "2021-01-14T10:32:50.5068927Z",

        "flags": {},

        "attributes": {},

        "paymentStatus": "Pending",

        "payments": [

            {

                "reference": "210121117372807180",

                "createDateTimeUtc": "2021-01-14T10:32:50.6776922Z",

                "paymentMethods": [

                    "Card"

                ],

                "status": "Pending",

                "amountToCollect": "10.00",

                "steps": [

                    {

                        "reference": "210121217372942352",

                        "createDateTimeUtc": "2021-01-14T10:32:50.7307589Z",

                        "action": "DisplayHostedPage",

                        "paymentMethods": [

                            "Card"

                        ],

                        "status": "Pending",

                        "amountToCollect": "10.00"

                    }

                ],

                "flags": {},

                "attributes": {

                    "returnUrlSuccess": "https://www.mywebshop.com/?paymentjobref=210121017238589452&paymentref=210121117372807180&ordernumber=Your+ref",

                    "returnUrlFailed": "https://www.mywebshop.com/?paymentjobref=210121017238589452&paymentref=210121117372807180&ordernumber=Your+ref",

                    "returnUrlCancelled": "https://www.mywebshop.com?paymentjobref=210121017238589452&paymentref=210121117372807180&ordernumber=Your+ref&status=cancelled"

                },

                "refunds": [],

                "captures": []

            }

        ]

    },

    "links": {

        "data": {

            "url": "https://gateway-int.cashflows.com/api/gateway/payment-jobs/210121017238589452",

            "type": "application/json"

        },

        "action": {

            "url": "https://gateway-int.cashflows.com/payment?ref=4ab07d818100e4880130c8e35d25ea1be6b35b94bf1416b2fda63815e83d9fbe68f1a4769d1abc9cf0e57616aa70a8b327f0354f1611fd216383cdd28d5d5580",

            "type": "text/html"

        },

        "documentation": {

            "url": "https://gateway-int.cashflows.com/payment-gateway-api/documentation/index.html",

            "type": "text/html"

        }

    }

}

Back to top