For developers
By Qliro
1 2 3 4
window.q1Ready = function(q1) { q1.onPaymentDeclined(paymentDeclinedListener); // ... }
Parameter | Type | Description | Mandatory |
callback | function | A function without parameters | Yes |
1 2 3
q1.onCheckoutLoaded(function callback() { //the checkout has been loaded successfully })
Parameter | Type | Description | Mandatory |
callback | function | A function that takes a customer (object). If the address is masked the object will only contain isMasked set to true and if there is no address yet the address object will be null. | Yes |
1 2 3
q1.onCustomerInfoChanged(function callback(customer) { // Save customer info })
1 2 3 4 5 6 7 8 9 10 11 12 13 14
{ "email": "test@qliro.com", "mobileNumber": "0123456789", "personalNumber": "0987654321", "address": { "firstName": "FirstName", "lastName": "LastName", "street": "Street", "city": "City", "careOf": "", "postalCode": "12345", "isMasked": false } }
Parameter | Type | Description | Mandatory |
callback | function | A function that takes an order (object) argument and calls unlock if the order is updated. | Yes |
1 2 3 4 5 6 7 8
q1.onOrderUpdated(function (order) { // if order reflects the local cart, use q1.unlock() if (order.totalPrice === localCart.totalPrice) { // exampel of how the order can be verified q1.unlock() } // else, don't do anything })
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
{ "totalPrice": 350, "orderItems": [ { "merchantReference": "RedHat", "pricePerItemIncVat": 100, "quantity": 3 }, { "merchantReference": "BlackHat", "pricePerItemIncVat": 50, "quantity": 1 } ] }
Parameter | Type | Description | Mandatory |
callback | function | A function without parameters. | Yes |
1 2 3
q1.onCustomerDeauthenticating(function callback() { // The customer has chosen to deauthenticate })
Parameters | Type | Description | Mandatory |
callback | function | A function that takes a paymentMethod (object) argument. The paymentMethod object will contain method (string), subtype (string), price (number) and priceExVat (number). | Yes |
1 2 3
q1.onPaymentMethodChanged(function callback(paymentMethod) { // For example: Apply payment based discounts })
Parameter | Type | Description | Mandatory |
callback | function | A function that will be executed if the payment is declined by the merchant backend. A declineReason (string) and possibly declineReasonMessage (string) will be passed as an argument and will reflect the response of the merchant backend. | Yes |
1 2 3
q1.onPaymentDeclined(function callback(declineReason, declineReasonMessage) { // Depending on the declineReason, inform the customer what to do next })
declineReason | Description |
OutOfStock | One or more of the items in the cart is now out of stock. |
PostalCodeNotSupported | The merchant does not deliver to the shipping address provided by the customer. |
ShippingIsNotSupportedForPostalCode | The selected shipping method does not support the shipping address provided by the customer. |
Parameter | Type | Description |
onStart | function | A callback that will be executed when the payment process starts. |
onEnd | function | A callback that will be executed when the payment process ends. |
1 2 3 4 5
q1.onPaymentProcess(function onStart() { // Lock the interface to prevent the customer from changing the order }, function onEnd() { // Unlock the interface to open up for order changes again })
Parameter | Type | Description | Mandatory |
updateToken | function | A function that will be executed when the customer acknowledges the session expiration. This function will replace the default behavior. | Yes |
1 2 3
q1.onSessionExpired(function updateToken() { // Implement a way to update the token })
Parameter | Type | Description | Mandatory |
callback | function | A function that takes a shipping (object) argument. The shipping object will contain method (string), secondaryOption (string), additionalShippingServices (array of strings), price* (number), priceExVat (number), totalShippingPrice* (number) and totalShippingPriceExVat (number). | Yes |
1 2 3
q1.onShippingMethodChanged(function callback(shipping) { // For example: Apply discounts based on shipping method and options })
Parameter | Type | Description | Mandatory |
callback | function | A function that takes a newShippingPrice (number) and newTotalShippingPrice (number) arguments. | Yes |
1 2 3 4
q1.onShippingPriceChanged(function callback(newShippingPrice, newTotalShippingPrice) { // For example: Apply discounts based on amount including shipping price // newTotalShippingPrice includes costs for both shipping and selected additional shipping services })