Created with Sketch.
Created with Sketch.
Checkout 3.0

Client-side validation

It’s an external validation provided by merchant before customer is allowed to complete purchase. This validation is optional and can be asynchronous.

How to set?

There is an option to pass beforeSubmitCallback callback to Checkout, with other initial settings. When Checkout gets this callback, every time before customer complete purchase, it is called and you have option to validate your own forms or do some other stuffs.

Payload in this callback is an object with zip, country and selectedPaymentMethodId string properties. Value in property country is ISO country code – SE, FI, etc.

How to continue to complete payment?

When your forms are valid and Checkout can continue to complete payment, you have to call beforeSubmitContinue callback, which is provided by Checkout in his instance returned from avardaCheckoutInit. After that Checkout will continue to complete payment. Meantime Checkout is fully disabled to prevent other actions and user can’t do nothing in Checkout – except reading currently shown informations.

When your forms are invalid or you don’t want let Checkout complete payment, you can call beforeSubmitAbort and Checkout won’t continue to complete payment and enable back all forms.