CopyandPay Options (cnp_Options)

Follow

This article explains how to use the cnp_Options Javascript variable for modifying the look and feel and behavior of CopyandPay widget.

First, integrateCopyandPay as described in the Integration Guide

Then get an overview of the existing use cases that show you the API parameters in action.

Note: cnp_Options is completely optional.

 

Available options

In case you want to change some payment defaults and behaviors, add the cnp_Options to your payment page embedded between <script> tags as follows:

<script>

 

var cnp_Options = {

 

//initialization

 

autoStart: true,                                   

// Render payment forms on DOM ready.

onReady: function(){},                             

// Triggers when the widget.js file is ready & the Api is available. Context (this) is the Api.

onLoad: function(){},                              

// Triggers when all payment forms are ready & the Api is available. Context (this) is the Api.

     

 

// iframe settings

 

paymentTarget:'cnpIframe',                        

// Sets payment forms target attribute.

iFrameSize: {width: 400, height: 580},             

// Sets size of the 'cnpIframe' iframe.

 

 

// payment validation

 

validation: true,                                  

// Use validation. If false disables validation and the functions validate* and on*Submit* will not be called.

validateCard: function(){},                        

// Triggers before onBeforeSubmitCard. Context (this) is the form. Overrides the internal validate card function.

validateDirectDebit: function(){},                 

// Triggers before onBeforeSubmitDirectDebit. Context (this) is the form. Overrides the internal validate direct debit function.

validateOnlineTransfer: function(){},              

// Triggers before onBeforeSubmitOnlineTransfer. Context (this) is the form. Overrides the internal validate online transfer function.

validateVirtualAccount: function(){},              

// Triggers before onBeforeSubmitVirtualAccount. Context (this) is the form. Overrides the internal validate virtual account function.

 

 

// payment submission

 

onBeforeSubmitCard:function(event){},             

// Triggers before card payment submission. Context (this) is the form. Overrides the internal submit function. Do event.preventDefault() or return false to cancel the payment submit action.

onBeforeSubmitDirectDebit:function(event){},      

// Triggers before direct debit payment submission. Context (this) is the form. Overrides the internal submit function. Do event.preventDefault() or return false to cancel the payment submit action.

onBeforeSubmitOnlineTransfer:function(event){},   

// Triggers before online transfer payment submission. Context (this) is the form. Overrides the internal submit function. Do event.preventDefault() or return false to cancel the payment submit action.

onBeforeSubmitVirtualAccount:function(event){},   

// Triggers before virtual account payment submission. Context (this) is the form. Overrides the internal submit function. Do event.preventDefault() or return false to cancel the payment submit action.

onAfterSubmit: function(){},                       

// Triggers after the payment submission. Context (this) is the form.

}

 

</script>

 

<script async src="https://test.ctpe.net/frontend/widget/v4/widget.js;jsessionid={token}"></script>

<!-- change {token} to be your token -->

 

Have more questions? Submit a request

Comments

Powered by Zendesk