windcave-ui

Allow your projects to take payments with Windcave.

Credit/Debit cards supported only.

Testing Credit Cards

Usage

This component requires no dependencies, use the <windcave-ui> HTML custom element where you wish to display. Ensure to import the script on your page.

Consume the windcaveTransactionFinished event, which gets emitted when a transaction is chosen and performed by the user. Please note that this event only informs that the transaction has occurred, but it does not show its status. To do so, you need to obtain the transaction result.

<windcave-ui submit-card-link="https://test-submit-link.com"></windcave-ui>
<script src="https://uicomponent.live.pci.cavu-tech.com/payments.js"></script>
<script>
el = document.querySelector('windcave-ui')
function getTransactionResult () {
   fetch('https://example.com/transactions')
     .then(response => response.json())
     .then(result => {
       // Pass the result through to the component.

       el.dispatchEvent(new CustomEvent('complete', { detail: result }))
       if (result.success) {
         alert('Payment successful')
       } else {
         el.dataset.error = 'There was an error'
       }
     })
};

el.addEventListener('windcaveTransactionFinished', function(event) {
   console.log(event.detail);
   getTransactionResult();
});

</script>

Sandbox Example

See demo here

Example cards
Card NumberCard TypeResponse
4111 1111 1111 1111VISAValid
5431 1111 1111 1111MasterCardValid
3774 0011 1111 115American ExpressValid

For more information. see https://magusa.atlassian.net/wiki/spaces/MU/pages/1241743362/Windcave+Test+Card+Details

Properties

PropertyAttributeTypeDefaultDescription
applePayMerchantIdapple-pay-merchant-idstring"merchant.com.test.cavu"This option indicates the Apple Pay merchant id
configdata-config{ monitorApplicationId: null; monitorClientToken: null; environment: string; submitCardDetailsLinks: { href: string; rel: string; method: string; }[]; }Object that contains config for Windcave
monitorApplicationId, monitorClientToken are used for DataDog logs
submitCardDetailsLink - link for submitting user card details
This link is received while creating a session with rel="ajaxSubmitCard"
See https://www.windcave.com/developer-ecommerce-drop-in#creating_a_session
configurableboolean
currencyCodecurrencystring"USD"This option indicates the currency is used, default value - 'en-US'
enumerableboolean
errorCodestring""
fullBrandColourbrand-colourstring""The primary brand color in RGBA format.
googleAccountBusinessIdgoogle-account-business-idstring""MerchantId from Google Pay Business Profile
The detail information can be found here
https://developers.google.com/pay/api/web/guides/test-and-deploy/publish-your-integration#create-your-profile
googlePayMerchantIdgoogle-pay-merchant-idstring"mid_f457ac19cf41425899ff13882227da57"This option indicates the Google Pay merchant id
isApplePayAvailablebooleanfalseIndicates whether Apple Pay is available and rendered for the current session
isApplePayEnabledis-apple-pay-enabledbooleantrueFeature flag which indicates if Apple Payment is enabled
isBasicStylingdata-basic-stylingbooleantrueThis option hides certain UI elements (payment button, borders, padding)
to provide more basic appearance for Windcave payment widget
isGooglePayAvailablebooleanfalseIndicates whether Google Pay is available and rendered for the current session
isGooglePayEnabledis-google-pay-enabledbooleantrueFeature flag which indicates if Google Payment is enabled
langdata-langstring"en-US"The language to use for the display text.
This will determine which translated text to display.
Default is 'en-US'.
localelocalestring"en-US"This option indicates the locale is used, default value - 'en-US'
observeranynullMutationObserver instance
It is initially set to null until an observer is assigned.
paymentChosenstringThe selected payment option, which could be a card, Apple Pay, or Google Pay, based on the user's choice
showErrordata-show-errorbooleanfalseThis options notifies windcave widget that transaction is not successful
showMobileMenushow-mobile-menubooleanfalseA feature flag used to control the visibility of the mobile navigation menu.
totalValuetotal-valuestring"10.00"This option indicates total value to be paid

Events

Event
windcavePaymentError
windcaveTransactionFinished
windcaveWidgetLoaded