Clearpay
Introduction
Clearpay is a credit payment provider that allows customers to spread the cost of their order value over multiple payments. Aurora's integration with Clearpay allows your customers to make use of Clearpay's payment plans when placing orders via the Aurora Front-end.
When using the Clearpay integration, all captures, refunds and voids for orders found in Aurora should be performed via Aurora. While the Clearpay Retailer Portal does present the option to refund and void orders, these actions will not be reflected in Aurora if performed from the Clearpay Portal and so this should be avoided if at all possible.
Initial Setup
The Clearpay Integration uses the Aurora Microservice (MS) framework, and as such must be set-up in advance by Aurora Commerce before you can use it with your store.
Doing this requires a one-off development to setup and configure your store to use the Clearpay MS, after which, you can then configure the integration at your own leisure.
If you have not yet had (or do not know if you have had) the Clearpay MS set up and configured for your store, then please contact Aurora Commerce for more details regarding how to get this done.
In order to configure your Clearpay MS, you will need to request the following details from Clearpay:
- Clearpay API endpoint prefix
- Clearpay Merchant ID
- Clearpay API key
Please request these details for both Staging (Test) and Production (Live) environments, so that you can test your integration before go live.
Aurora Backend Settings
Once the Clearpay MS has been setup and enabled for your store, you can follow these steps to allow your customers to use it on your front-end checkout.
Enable the Clearpay Microservice
Store > Settings > Feeds > Microservice > Proxy Clearpay
Configure visibility of the Clearpay payment option (in conjunction with the "Payment Types Accepted at Checkout" setting):
Parameter Name | Value For Integration | Note |
---|---|---|
Enabled? | checked | Controls whether the Clearpay payment option is visible on your checkout page: checked = accessible and visible unchecked = not accessible and not visible |
This 'visibility behaviour' is enforced entirely within the Aurora Front-end Templates and so is the default behaviour offered by the Aurora Demo Example Front-end Templates, but may not be how your own Front-end Templates are configured.
If you run into issues with payment option visibility, please check your Front-end Templates for the appropriate logic.
Payment Types Accepted at Checkout
Store > Settings > Payment Providers
Configure Aurora to accept orders using the Clearpay payment type:
Parameter Name | Value For Integration | Note |
---|---|---|
Validate Payment Type | checked | Controls whether the checkout enforces a strict/reduced list of payment types that are accepted on checkout submission. checked = payment types are enforced to the defined list unchecked = payment types are not enforced to the defined list |
Clearpay | checked | Controls whether Clearpay is on the list of payment types that will be accepted on checkout submission. checked = Clearpay is accepted and visible on checkout submission unchecked = Clearpay is not accepted and not visible on checkout submission |
This 'visibility behaviour' is enforced entirely within the Aurora Front-end Templates and so is the default behaviour offered by the Aurora Demo Example Front-end Templates, but may not be how your own Front-end Templates are configured.
If you run into issues with payment option visibility, please check your Front-end Templates for the appropriate logic.
Microservice Settings
Store > Microservice > Proxy Clearpay
Configure the Clearpay MS to communicate with the Clearpay API:
Parameter Name | Value for Integration | Notes |
---|---|---|
Is Live | Checked - for Live Unchecked - for Test | Whether the account uses the live or test credentials. |
Payment Type | PAYMENT - Takes payment immediately on order placement. DEFERRED - Only Defers/Authorises payment on order placement. | When using the DEFERRED method, payment must be captured at some point later in your order lifecycle, e.g. during dispatch, which Aurora supports doing automatically for you, should you wish to do this. |
Live API Endpoint Prefix | https://api.eu.afterpay.com | Unique prefix for the endpoint used by the Clearpay MS to contact the Clearpay API. This can be found in the Clearpay documentation here: https://developers.clearpay.co.uk/clearpay-online/v2/reference#api-environments |
Live API Merchant ID | Example value (do not use): 123456 | Merchant Account ID to be used with the Live API endpoint. |
Live API Key | Example value (do not use): AQEphmfuXNWTK0Qc+iSRh3Y3teW4R 4ZACDad23IFJXUVCV0MjUrgpBR20FW5ZAa IQwV1bDb7kfNy1WIxIIkxgBw==-Er LKmM7hzDfeJPBKLLtniCu+V3JvIHv jsrkHxjufjtc=-KfLC5q6UaIPK38mH | API Key to be used with the Live API endpoint. |
Test API Endpoint Prefix | https://api.eu-sandbox.afterpay.com | Unique prefix for the endpoint used by the Clearpay MS to contact the Clearpay staging API. This can be found in the Clearpay documentation here: https://developers.clearpay.co.uk/clearpay-online/v2/reference#api-environments |
Test API Merchant ID | Example value (do not use): 654321 | Merchant ID to be used with the Test API endpoint. |
Test API Key | Example value (do not use): AQEphmfuXNWTK0Qc+iSRh3Y3teW4R 4ZACIFJstgj87XUVCV0MjUrgpBR20FW5ZAa IQwV1bDb7kfNy1WIxIIkxgBw==-Er LKmM7hzDfeJPBKLLtniCu+V3JvIHv jsrkHxjufjtc=-KfLC5q6UaIPK38mH | API Key to be used with the Test API endpoint. |
Minimum and Maximum order values
Clearpay has restrictions on the values that can be passed through to its payment service. These take the form of maximum and minimum order values. When these are set (in Clearpay) it will result in payments being rejected if the total order value does not fall within these limits.
If you wish to change these limits, you must do so from the Clearpay Administrative Portal as Aurora does not manage these limits for you.
To help ensure that the customer experience is a smooth as possible, Aurora imports these values once a day for you in order to allow you to tailor your checkout process based on the order value and the availability of credit from Clearpay.
For more detail on how to tailor your checkout as suggested here, please see the Frontend Template Integration > Checking the Clearpay Payment Limits section of this support article.
You are able to view the values currently imported into Aurora (which are updated once a day from Clearpay) from within the Aurora Back-end under the Proxy Clearpay setting section.
Aurora Service Errors
Content > Site Text
User error messages from the Aurora payment service that can be changed and translated using the Aurora Site Text system:
Page | Part | Note |
---|---|---|
Checkout | CheckoutPayment proxy-clearpay Error: MSRequestInvalid | A general error when a request to the payment service cannot be provided. This may be resolvable if the user tries the operation again. |
Checkout | CheckoutPayment proxy-clearpay Error: MSResponseInvalid | A general error when a response from the payment service cannot be provided. This may be resolvable if the user tries the operation again. |
Checkout | CheckoutPayment proxy-clearpay Error: MSConfigurationError | The Clearpay MS has not been configured correctly and is unable to connect to the Clearpay API. |
Checkout | CheckoutPayment proxy-clearpay Error: MSPaymentProviderError | The Clearpay API has responded with an unknown error. More details on these errors can be found within: Store > Logs > API Integration Log |
Checkout | CheckoutPayment proxy-clearpay Error: MSPaymentProviderConnectionError | The Aurora Clearpay service was unable to connect to the Clearpay API. More details on these errors can be found within: Store > Logs > API Integration Log |
Checkout | CheckoutPayment proxy-clearpay Error: MSPaymentCancelled | The customer cancelled payment within Clearpay and was returned to checkout. |
Checkout | CheckoutPayment proxy-clearpay Error: MSPaymentDeclined | The customers payment request was declined by Clearpay and was returned to checkout. |
Frontend Template Integration
Displaying the Clearpay Payment Option
In order to use the Clearpay MS within your checkout, you must simply include the following values within your checkout submission:
Name | Value |
---|---|
payment_type | proxy-clearpay |
payment_custom_fields[proxy-clearpay] | true |
Example template:
{if $config.microservice_proxyclearpay_live}
{include file="checkout/clearpay/payment-methods.tpl.html"}
{/if}
Find the content of the "checkout/clearpay/payment-methods.tpl.html" file within the Aurora Demo templates.
Checking the Clearpay Payment Limits: Payment Limits Callback
Before you begin, please be aware that the Aurora Demo Front-end Templates already have a working implementation of this behaviour, enabling and disabling Clearpay based on the Ajax call to Aurora. This being so, you need only read the following for your reference should you wish to implement your own solution.
Find the existing implementation of this in the templates/example.com/_js/clearpay.payments.js file for your reference.
Request Data
To make a call to the Aurora Callback endpoint to fetch the limits, you should make a request to the following endpoint with the parameters as described below:
Endpoint: /checkout/payment-client-callback
Method: POST
Parameter Name | Value | Description |
---|---|---|
route | "payment-methods" | This is a static string value that must always be provided as described here, so that the Callback endpoint knows what is being requested. |
use_dummy_payment_data | true | This is a static boolean value that must always be provided as described here in order to tell Aurora to avoid creating any payment session data along-side this call. |
payment_detail | This is a container. | |
payment_detail.amount_total | Float | This is the value you are looking to check. It should be the total value of the customers current basket. |
payment_type | "proxy-clearpay" | This is a static string value that must always be provided as described here, so the the Callback endpoint knows which payment service to send this request to. |
Response Data
You can use the Aurora Client Callback to fetch the following information:
Format: JSON
Response Variable Name | Value | Description |
---|---|---|
allowPayment | Boolean | This indicates whether Clearpay will accept a request for the value specified, based on the currently configured limits and should be used to decide whether to display/enable the Clearpay payment option on your checkout. |
minimumAmount | Float | The currently configured minimum value is returned for your reference. The Aurora Demo Example Front-end Templates do not currently use this value, but you could do so if you wished to indicate to the customer how much more they should spend in order to qualify for Clearpay. |
maximumAmount | Float | The currently configured maximum value is returned for your reference. The Aurora Demo Example Front-end Templates do not currently use this value, but you could do so if you wished to indicate to the customer how much less they should spend in order to qualify for Clearpay. |
Notes for Testing
When testing the Clearpay integration, you should keep the following in mind.
SMS Mobile Phone Verification
During testing, using your ClearPay Test Account, you may run into the need to verify your mobile phone number. When this occurs, simply use 111111 as the verification code.
Updated over 2 years ago