An overview of how the intergration with the Accounting as a Service pre-built UI solution looks like.
When it comes to developing the integration and connecting your business application (e.g. your web shop) with the payment module, we provide you with a pre-built UI solution to be used for accepting payments. In addition to the integration based on our pre-built UI solution, all additional integration will be REST-based by consuming the endpoints of our API.
The pre-built UI solution mainly consists of a JavaScript-based UI component that you will have to integrate. The UI component enables you to fulfil PCI requirements by autonomously rendering all payment method forms and fields while encapsulating sensitive data in an iFrame and handling all communication with the Accounting as a Service REST API independently of your web shop.
While working with the frontend widget being part of the pre-built UI solution, we provide you with an out-of-the-box UI that you can use for accepting payments. This widget is highly customizable and can be adapted to your needs, allowing you to match the styling to your brand, and the language to your shopper. The integration is easy and works without extensive front-end development being needed.
The pre-built UI can be easily styled according to you corporate layout. Please find one example below:
A high-level process overview showcasing a sample process using the frontend widget followed by the REST API being consumed.
Before you start with the implementation, here is some general information related to the integration of the pre-built UI solution that will help you to follow the step-by-step implementation as described below.
To make use of the pre-built UI solution, you will have to integrate the component in your code handling the checkout procedure of your web shop. The widget is bundled as a JavaScript file that you can import in your code using the HTML tag <script type="text/javascript" src="..."></script>
. For development purpose, the file should be referenced from the following address during your integration and testing work:
https://test.arvato-payment.de/{merchantID}/Pmg.Site/Scripts/v2/WidgetApi.js
For production purpose, you will have to switch to the following address:
https://www.arvato-payment.de/{merchantID}/Pmg.Site/Scripts/v2/WidgetApi.js
The {merchantID}
will be provided to you as part of your registration confirmation.
In order to configure the widget, you will have to make use of Arvato.PayNext.WidgetApiOptions
which is part of the WidgetAPI component library. The object type comes along with the following configuration options, of which some are mandatory.
Field | Description |
---|---|
tokenizationServiceUrl | The tokenization end point URL provided by Arvato. Example: String URL |
securityToken | The security token received via /payments/{version}/token .Example: String (GUID) |
placeHolder | The ID of the HTML element where the widget content will be rendered in. |
countryCode | The country code of your business code in ISO 3166-1 Alpha-2 format. Example: DE |
currencyCode | The currency code of your business code in ISO 4217 format. Example: de |
paymentMethods | A comma separated list of payment methods.
Using this field, the shop can reduce the list of payment method to be displayed.
Using "*" as value will result in displaying all payment methods configured for the related business code (i.e. country/currency code)
The field can be left empty, in which case no payment methods will be displayed. Default value: null |
successCallback | The JavaScript method that handles the success callback from the tokenization process. Example:
|
Field | Description |
---|---|
culture | The culture code in ISO 639-1 format. Default value: en-US Example: de-DE |
displayValidationErrors | If validation errors shall (also) be displayed within the widget area. Default value: false |
errorCallback | The JavaScript method that handles the error callback from the tokenization process. Example:
|
frameWidth | The widget frame width in pixel (px). Default value: 1000 |
frameHeight | The widget frame height in pixel (px). Default value: 400 |
renderErrorCallback | The JavaScript method that handles the error callback from the rendering process Example:
|
automaticParentResize | If true, the iframe parent DOM element will resize according to the content of the iframe. The content of the widget will respond to the resize of the parent page. Default value: false |
onWidgetContentResized | The custom function that is triggered when the widget content is resized. Default value: null Example:
|
disableIntroductionText | Suppresses the text label "Please enter your payment data" which is normally displayed above the actual payment methods. Default value: false |
amount | Transaction amount. It is required for instalment payment methods (e.g. AfterPay) or PayPal v2. Default value: null Example: 120.34 |
unifiedPaymentMethodLogos | Displays payment method logos with unified width and height. Default value: false |
enforcePaymentMethodsOrder | If this is set to true, the order of the payment methods displayed in the widget will be the one specified in the widget option "paymentMethods" (unless the value is null or "*"). Default value: false |
firstName | First name used to prefill cardholder field. |
lastName | Last name used to prefill cardholder field. |
externalId | Shop OrderId if already available Conditional Required for PayPal v2 and Cardinal 3DS Check |
orderItems | The order items in the shopping cart Conditional Required for PayPal v2 See Object Arvato.PayNext.OrderItem |
shippingAddress | The shipping address Conditional Required for PayPal v2 See Object Arvato.PayNext.ShippingAddress |
widgetFrameTitle | Specifies the Title attribute of the IFrame containing the widget |
WCAGEnhacements | Specifies if certain features meant for impaired users (errors displayed on top of the form, asterisks displayed on mandatory cc fields) are activated Example: true, false |
MandateReference | Merchant mandate reference number (for certain DirectDebitSepa methods) Example: string value |
MandateConfirmationText | Merchant specific / language specific confirmation text to be displayed in the widget (for certain DirectDebitSepa methods) Example: string value |
PaymentAccountFor3Ds | The payment PSP Account (ID or Name) to be used in order to select the 3DS Provider for credit card device finger printing in the Widget. If the parameter is not specified, the widget will select any active entry for the specified country in the ThreeDSecure matrix that is enabled for all payment providers. If the parameter is specified, then the widget will select the corresponding active entry that is enabled either for all payment providers or for this specific provider account. If no 3DS Provider is found in the ThreeDSecure matrix, then no device finger printing will be performed. This will result in a downgrade of the 3DS version to 1.x. Example: string value |
Arvato.PayNext.ShippingAddress
Field | Description |
---|---|
streetName | The street name |
streetNumber | The street number |
additionalnformation | Additional Address information Example: Building A |
postalCode | The postal code / zip number |
City | Address City / Town |
stateCode | Address state code |
country | Address country |
Arvato.PayNext.OrderItem
Field | Description |
---|---|
productName | The name of the product |
grossUnitPrice | Total price included tax |
quantity | Number of items |
netUnitPrice | Price excluding tax |
taxValue | Tax value of an order item |
additionalProductInfo | Additional product details See Object Arvato.PayNext.ProductInfo |
Arvato.PayNext.ProductInfo
Field | Description |
---|---|
description | The product description |
sku | The product sku |
productType | Type of product Example: DIGITAL_GOODS, PHYSICAL_GOODS, DONATION |
Sequence-wise, you need to pass the following steps when using the pre-built UI solution:
Arvato.PayNext.WidgetApiOptions
object (Hint: You will need the security token as part of the configuration to be set)Arvato.PayNext.WidgetApi
object, show the widget using the render()
method and ensure that the tokenize()
method can be called for the processing and generation of the payment token.For further processing, please refer to the payment-specific use cases, especially payment request.
Before you can initialize the frontend widget, you will have to request a security token, which needs to part of the widget configuration. To request a security token, make a POST /payments/{version}/token
request. You will be returned by a new token that you can use for setting WidgetApiOptions.securityToken
.
GET /payments/v1/token HTTP/1.1
Host: api-test-aqount.finance.arvato.com
X-Subscription-Key: YOUR_API_SUBSCRIPTION_TOKEN
HTTP/1.1 200 OK
Content-Type: application/json
{
"securityToken": "EEB8A443-AC0C-4A81-8015-0001D0446037",
"version": "1.0"
}
Setting up the WidgetApiOptions
object followed by the widget usually takes place in your frontend code. The following sample shows how to load the related library, create an instance of the object, and how to set the required properties. The given example assumes the merchantId
to be AAAAA
and the previously requested securityToken
to be EEB8A443-AC0C-4A81-8015-0001D0446037
.
<!DOCTYPE html>
<html>
...
<!-- Minimal list of HTML elements to be referenced in the following JS code -->
<div id="content"></div>
<input type="button" id="Tokenize" value="Tokenize" />
<div id="widgetContent"></div>
<div id="resultDiv"></div>
<!-- Load jQuery as we will needed it -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Load widget component library using merchant specific URL -->
<script type="text/javascript" src="https://test.arvato-payment.de/AAAAA/Pmg.Site/Scripts/v2/WidgetApi.js">
</script>
<!-- Configure the widget -->
<script type="text/javascript">
var merchantID = "AAAAA";
var securityToken = 'EEB8A443-AC0C-4A81-8015-0001D0446037';
// Initiate WidgetApiOptions
var widgetApiOptions = new Arvato.PayNext.WidgetApiOptions();
widgetApiOptions.tokenizationServiceUrl = 'https://test.arvato-payment.de/' + merchantID +
'/Pmg.Site/WidgetApi/Home/Index';
widgetApiOptions.securityToken = securityToken;
widgetApiOptions.placeHolder = 'widgetContent';
widgetApiOptions.countryCode = 'DE';
widgetApiOptions.currencyCode = 'EUR';
widgetApiOptions.culture = 'de-DE';
widgetApiOptions.paymentMethods = 'Visa';
widgetApiOptions.successCallback = successCallback;
// The callback function to be executed upon success
function successCallback(response) {
document.getElementById("resultDiv").innerHTML = "Success! Payment Token Received: " +
response.PaymentToken;
}
...
Once the WidgetApiOptions
object has been set up, the widget can be initiated and shown. To continue with the example above, let's continue at the point where WidgetApiOptions
has been fully configured.
// Initiate WidgetApiOptions
var widgetApiOptions = new Arvato.PayNext.WidgetApiOptions();
...
// Once the page has been fully loaded
$(document).ready(function () {
// Initiate and show the widget
var widget = new Arvato.PayNext.WidgetApi(widgetApiOptions);
widget.render();
// Allow to trigger tokenization process
$('#Tokenize').click(function () {
widget.tokenize();
});
});
Calling the render()
method will show the widget and therefore start the payment method selection process. Once the payment method has been selected and all relevant user data has been collected, the tokenize()
method can be called. From this point on, you will have to wait until any of the callback methods (i.e. successCallback
or errorCallback
) will be called by the widget to proceed with your business logic. In case of successCallback
, you will be provided with the payment token which is the prerequisite for requesting the payment execution in the next step.
When handling the callbacks, you should be aware of the structure of the WidgetApiCallbackResponse
object that will be returned as response by the callback.
Property name | Data type | Description |
---|---|---|
Success | Boolean | Indicates if the request succeeded or not. |
Error | JsonError | Contains information about what happened. Only present if Success is false . |
PaymentToken | String | The generated payment token, a GUID stored as a string. |
PaymentMethodName | String | The selected payment method name (i.e. Visa, MasterCard, PayPal) associated with the payment token |
Property name | Data type | Description |
---|---|---|
ErrorCode | String | Optional numerical identifier of the error type. |
ErrorType | String | Stringified unique identifier of the error type. |
Message | String | Short description of the error based on the error type. |
Details | String | Details related to the error. |
InnerErrors | List of JsonError | List of nested errors. |
These are callback types you need to be aware of:
The callback is triggered when the tokenization process has been successfully executed. In this case, the response
object will contain the payment token and the payment method name. At this stage of the process, common next steps would be to provide the customer with a confirmation page and (once you received final confirmation) to request the payment execution.
{
"Success": true,
"PaymentToken": "936DA01F-9ABD-4D9D-80C7-02AF85C822A8",
"PaymentMethodName": "Visa"
}
The callback is triggered in case of the tokenization process running into an error. Here is a list of potential reasons causing the tokenization process to fail:
{
"Success": false,
"Error": {
"ErrorCode": null,
"ErrorType": "UnknownError",
"Message": "Input string was not in a correct format.",
"Details": "",
"InnerErrors": null
},
}
The callback is triggered upon server errors occurring during the rendition of the iFrame. Here is a list of potential reasons causing the rendition process to fail: