COPYandPAY API

COPYandPAY API enables you to further customize your checkout workflows.  Here you can find the reference for the wpwlOptions and you can see these in action on our workflow examples page.

ParameterDescriptionExamples
locale

Sets the language/country of the payment forms. Expects ISO 639-1 for languages and ISO 3166-1 alpha-2 for countries. Default is “en-US”.

Supported languages are: ar,be,bg,cn,cz,de,da,el,en,es,fi,fr,gr,hu,it,ja,ko,nl,no,pl,pt,ro,ru,sv,sk,sl,tr

Right-to-left languages are not supported by the number formatter. When using “ar”, for example, set numberFormatting:false

locale: “de-AT”

locale: “de”

Check the requirements of the connector you are integrating in your shop. If the connector requires to have the language and the country provided, use the format “de-AT”. If there is no requirement defined, you may use any of the two options.

styleSets the style of the payment forms. You can choose from “card”, “logos”, and “plain” style. Default is “card”style: “card”
autofocusSets focus to the selected input/select element on the payment page upon loadingautofocus : ‘card.holder’
onReadyTriggers when all payment forms are readyonReady: function() {/* function here */};
requireCvvDetermines whether the CVV field is presented on the payment form.requireCvv: false
allowEmptyCvvDetermines whether the CVV field can be empty. By default it is falseallowEmptyCvv: true
disableCardExpiryDateValidationDetermines whether the card expiry date field should be validated. By default it is validated (false).disableCardExpiryDateValidation: true
enableSAQAComplianceUse to make the credit card form SAQA compliant. Enabling this will render the card holder and expiry date fields in separate iFrames. By default it is falseenableSAQACompliance: true
useSummaryPageIf set to true, the payment is not completed, instead the form will initiate a callback to the onSaveTransactionData function, which can initiate a redirection to a summary page. This summary page can then be used to summarise the checkout before asking the user to confirm. An example can be seen on our advanced options page.useSummaryPage: true
onSaveTransactionDataTriggered after the shopper presses Continue on the CnP form, when useSummaryPage flag is set to true. Parameter “data” is the serialized data of the payment form.onSaveTransactionData: function(data){console.log(data);}
threeDIframeSizeSets size of the 3D secure iframe. This iframe will only be used in case a shopper has to enter 3D secure credentials on the bank’s page.‘threeDIframeSize’:{‘width’:’100%’, ‘height’:’580px’}
paymentTargetWe submit the form to this target. In case of additional shopper interaction, e.g. 3DSecure, we redirect the shopper within this target.

Important: This only works for card payment brands. The target should not be the same as the page frame name, otherwise the redirect will not work.
paymentTarget: ‘my3dIframe’
shopperResultTargetWorks only in combination with “paymentTarget” option.
By default, we redirect the shopper to the given “shopperResultUrl” using a self-submitting form with target=”_top”. If you use COPYandPAY in an iframe and want to redirect the shopper within this iframe, then the “shopperResultTarget” and the “paymentTarget” should be the name of this iframe.

Important: This only works for card payment brands. The target should not be the same as the page frame name, otherwise the redirect will not work.
paymentTarget: ‘myCustomIframe’,
shopperResultTarget: ‘myCustomIframe’
inlineFlowIndicates the alternative payment brand which should get rendered inline. No browser redirect will happen, all information which are required to process the transaction will be collected by an inline integration. The consumer will not leave the context of the merchant checkout page.inlineFlow: [‘KLARNA_PAYMENTS_PAYNOW’, ‘KLARNA_PAYMENTS_PAYLATER’, ‘KLARNA_PAYMENTS_SLICEIT’]
disableSubmitOnEnterDisables the submit of payment form when Enter key is pressed. By default it is falsedisableSubmitOnEnter: true
showTaxNumberFieldIf set to true the CPF field on the COPYandPAY form will be displayed. The CPF field is needed for payments processed in Brazil.showTaxNumberField: true
showCVVHintIf set to true then the credit card form will display a hint on where the CVV is located when the mouse is hovering over the CVV field.showCVVHint: true
brandDetectionIf the COPYandPAY form contains more than one credit card brand (e.g. MASTER VISA AMEX) and this option is set to true(default is false) then COPYandPAY updates the brand field automatically based on the first four digits entered in the credit card number field.brandDetection: true
brandDetectionPriorityMust be used together with brandDetection:true. This list changes the default priority of brand detection. It can be useful in case of two brands that share the same BINs. If a brand is omitted in the list, it will take the default priority.brandDetectionPriority: [“ALIA”, “IK_PRIVATE_LABEL”, “MAESTRO”, “VISA”]
brandDetectionTypeAvailable options are: “regex” and “binlist”. By default, regular expressions (“regex”) are used for the brand detection. The option “binlist” instructs COPYandPAY to search for brands from its internal BIN database. Usually, “binlist” produces better results than “regex”brandDetectionType: “binlist”
overridePaymentTypeIf one of the brands, or more, included in the form needs a paymentType different than the one defined in the checkout creation, use overridePaymentType[BRAND_NAME]=PAYMENT_TYPE to override the default type for this brand. You can override it to as many brands as you need.overridePaymentType[BOLETO]=PA
displayBicIf the COPYandPAY form contains DIRECTDEBIT_SEPA brand and this option is set to true(default is false) then COPYandPAY will display the BIC field.displayBic: true
forceCardHolderEqualsBillingNameBy default the card.holder is displayed as one field in COPYandPAY’s form. If this option is set to true then the form displays a field for the given name and a separate field for the surname. The values entered here will be submitted both as card.holder and as customer.givenName and customer.surname.
This option has no effect when enableSAQACompliance is enabled.
forceCardHolderEqualsBillingName: true
billingAddressOption to display the billing address fields.billingAddress: { country: “US”, state: “NY”, city: “New York”, postcode: “12345”, street1: “Suite 1234”, street2: “Some Road” }
mandatoryBillingFieldsDescribe which billing fields cannot be empty. This option needs to be used with billingAddress option.mandatoryBillingFields:{ country: true, state: true, city: true, postcode: true, street1: true, street2: false }
validationUse validation. If false disables validation and the functions validate* and on*Submit* will not be called.validation: true
validateCardTriggers before onBeforeSubmitCard. Context (this) is the form. Overrides the internal validate card function.validateCard: function(){ /* function here */}
validateDirectDebitTriggers before onBeforeSubmitDirectDebit. Context (this) is the form. Overrides the internal validate direct debit function.validateDirectDebit: function(){ /* function here */}
validateOnlineTransferTriggers before onBeforeSubmitOnlineTransfer. Context (this) is the form. Overrides the internal validate online transfer function.validateOnlineTransfer: function(){ /* function here */}
validateVirtualAccountTriggers before onBeforeSubmitVirtualAccount. Context (this) is the form. Overrides the internal validate virtual account function.validateVirtualAccount: function(){ /* function here */}
onDetectBrandTriggered every time a brand is detected and provides a list of possible brands.onDetectBrand: function(brands){ /*function here */}
onBlurSecurityCodeTriggers on leaving the card security code field. Context (this) is the iframe communication object.onBlurSecurityCode: function(isValid){ /* function here */}
onBlurCardNumberTriggers on leaving the card number field. Context (this) is the iframe communication object.onBlurCardNumber: function(isValid){ /* function here */}
onBlurCardHolderTriggers on leaving the card holderfield. Context (this) is the iframe communication object.
Only available when enableSAQACompliance is true.
onBlurCardHolder: function(isValid){ /* function here */}
onBlurExpiryDateTriggers on leaving the expiry date field. Context (this) is the iframe communication object.
Only available when enableSAQACompliance is true.
onBlurExpiryDate: function(isValid){ /* function here */}
onLightboxCancelCallback when the shopper cancels the transaction in the lightbox.onLightboxCancel: function(){ /* function here */}
executePaymentCalling executePayment(/*class name of the form container*/) triggers the payment form submission for a defined payment container.wpwl.executePayment(“wpwl-container-card”)
onBeforeSubmitCardTriggers 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.onBeforeSubmitCard: function(event){ /* function here */}
onBeforeSubmitDirectDebitTriggers 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.onBeforeSubmitDirectDebit: function(event){ /* function here */}
onBeforeSubmitOnlineTransferTriggers 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.onBeforeSubmitOnlineTransfer: function(event){ /* function here */}
onBeforeSubmitVirtualAccountTriggers 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.onBeforeSubmitVirtualAccount: function(event){ /* function here */}
onAfterSubmitTriggers after the payment submission. Context (this) is the form.onAfterSubmit: function(){ /* function here */}
onLoadThreeDIframeTriggers when the 3D secure targetIframe has loaded, Context (this) is the iframe.onLoadThreeDIframe: function(){ /* function here */}
spinnerSets the style of the loading spinner. We use the spin.js library to display the spinner. The full list of settings can be found on internet if you search for spin.js.spinner: {
color: “red”
}
sofortCountriesSets available countries for SOFORT Uberweisung.sofortCountries: {
  DE: “Deutschland”,
  NL: “Nederland”,
  AT: “Osterreich”,
  BE: “Belgique”,
  CH: “Schweiz”,
  GB: “United Kingdom”
}
onReadyIframeCommunicationTriggers when the communication between the PCI iframe and the payment form is established. Context (this) is the iframe communication object.onReadyIframeCommunication: function(){ this.$iframe.height(200) }
onFocusIframeCommunicationTriggers when the shopper focuses the input element in the PCI iframe. Context (this) is the iframe communication object.onFocusIframeCommunication: function(){ this.$iframe.height(200) }
onBlurIframeCommunicationTriggers when the shopper leaves the input element in the PCI iframe. Context (this) is the iframe communication object.onBlurIframeCommunication: function(){ this.$iframe.height(200) }
showLabelsShows or hides input labels. Default is trueshowLabels: false
showPlaceholdersShows or hides input showPlaceholders. Default is trueshowPlaceholders: false
labelsOverrides labels from the list of available labels.labels: {cardHolder: “Name on card”, cvv: “Security code”}
errorMessagesOverrides error messages from the list of available error messages.errorMessages: {cardHolderError: “Invalid name on card”, cvvError: “Invalid security code”}
onErrorCallback that triggers if an error occurs during checkout. The error.name should be read for details.
Possible errors:
  • InvalidCheckoutIdError: Shopper waits for 30 minutes and pays then. The checkoutId is already expired. See error.message for details
  • PciIframeSubmitError: Error submitting card number or/and card cvv, e.g. the request run into a timeout. See error.message for details
  • PciIframeCommunicationError: Merchant page is not able to communicate with PCI iframes. See error.message for details
  • WidgetError: When shopper did not completed the payment in an external integration for any reason. To determine the widget type check error.brand. To determine the widget error type check error.event. Possible values:
    cannot_insert_widget
    the widget cannot be inserted into the page
    sdk_not_downloaded
    the 3rd party client api could not be downloaded (connection lost, URL no longer valid, etc)
    sdk_not_initialized
    there is an error during the widget initialization phase
    widget_not_rendered
    there is an error during the widget rendering phase
    closed
    the shopper closes the widget before completing the payment
    auth_rejected
    3rd party rejects the authorization because their own risk check denies it
    auth_error
    there is an error thrown by 3rd party during authorization step

Brand-Specific Parameters

Some brands also use very specific parameters in order to provide an appropriate user experience during checkout. The COPYandPAY API also allows you to customize these brand-specific parameters.  Here you can find the reference on brand-specific parameters for wpwlOptions.

ParameterDescriptionExample
KLARNA_INVOICE.feeSets the fee to be used for the “Billing agreement” link during a Klarna Invoice checkout. Default is 0.KLARNA_INVOICE = {fee: 3.8}
KLARNA_INSTALLMENTS.feeSets the fee to be used for the “Read more” link during a Klarna Installments checkout. Default is 0.KLARNA_INSTALLMENTS = {fee: 3.8}
styling.layout

Sets a layout of Paypal Smart Payment Buttons during a Paypal checkout when multiple buttons are available. Default is “vertical”.

Supported options are: “vertical”, “horizontal”.

styling: {layout: “vertical”}
styling.color

Sets a color of Paypal Smart Payment Buttons during a Paypal checkout. Default is “gold”.

Supported options are: “gold”, “blue”, “silver”, “white”, “black”.

styling: {color: “gold”}
styling.shape

Sets a shape of Paypal Smart Payment Buttons during a Paypal checkout. Default is “rect”.

Supported options are: “rect”, “pill”.

styling: {shape: “rect”}
styling.height

Sets a height of Paypal Smart Payment Buttons during a Paypal checkout. To customize button width alter width of the container element.

Supported values are from 25 to 55.

styling: {height: 25}
styling.label

Sets a label of Paypal Smart Payment Buttons during a Paypal checkout. Default is “paypal”.

Supported options are: “paypal”, “checkout”, “buynow”, “pay”.

styling: {label: “paypal”}
styling.tagline

Displays a tagline of Paypal Smart Payment Buttons during a Paypal checkout. Default is true.

Supported options are: true, false

Labels

KeyValue
accountBankBank code
accountBankBicBIC or bank code
accountBicBIC
accountHolderAccount holder
accountIdId
accountNumberAccount number
accountNumberIbanIBAN or account number
accountIbanIBAN
bankNameName of bank
brandBrand
cancelBack
cardHolderCard holder
cardNumberCard Number
cvvCVV
cvvHintThe 3 digits on the back of your card
cvvHintAmexThe 4 digits on the front of your card
cvvHintMaestroThe 3 digits on the back of your card if specified
countryCountry
expiryDateExpiry Date
taxNumberTax Identification Number
submitPay now
nextStepContinue
billingAgreementInvoice terms and conditions
emailOrAccountIdEmail or Account Id
secureIdSecure Id
learnMoreLearn more
mmyyMM / YY
customerMobileMobile phone number (+78000001774)
registerRegister now
showOtherPaymentMethodsShow other payment methods
olpIdOLP ID
birthDateDate of birth

Error Messages

KeyValue
accountBankErrorInvalid bank code
accountBankBicErrorInvalid BIC or bank code
accountBicErrorInvalid BIC
accountHolderErrorInvalid account holder
accountNumberErrorInvalid account number
accountNumberIbanErrorInvalid IBAN or account number
accountIbanErrorInvalid IBAN
cardHolderErrorInvalid card holder
surNameErrorInvalid surname
givenNameErrorInvalid given name
cardNumberErrorInvalid card number or brand
cvvErrorInvalid CVV
expiryMonthErrorInvalid expiry date
expiryYearErrorInvalid expiry date
taxNumberErrorInvalid Tax Identification Number
generalTermsAndConditionsErrorPlease accept the consent for data transmission
billingCountryErrorInvalid country
billingStateErrorInvalid state
billingCityErrorInvalid city
billingStreetErrorInvalid street
billingPostCodeErrorInvalid postcode

Payment containers

KeyDescriptionExample
wpwl-container-cardAll card payment options are provided within that container.
wpwl-container-directDebitAll direct debit options are provided within that container.
wpwl-container-prepayment-{brand_name}The specific prepayment option is provided within that container.wpwl-container-prepayment-BITCOIN
wpwl-container-onlineTransfer-{brand_name}The specific online transfer option is provided within that container.wpwl-container-prepayment-GIROPAY
wpwl-container-virtualAccount{brand_name}The specific virtual account payment option is provided within that container.wpwl-container-virtualAccount-PAYPAL