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
Example cards
Card Number | Card Type | Response |
---|---|---|
4111 1111 1111 1111 | VISA | Valid |
5431 1111 1111 1111 | MasterCard | Valid |
3774 0011 1111 115 | American Express | Valid |
For more information. see https://magusa.atlassian.net/wiki/spaces/MU/pages/1241743362/Windcave+Test+Card+Details
Properties
Property | Attribute | Type | Default | Description |
---|---|---|---|---|
applePayMerchantId | apple-pay-merchant-id | string | "merchant.com.test.cavu" | This option indicates the Apple Pay merchant id |
config | data-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 | |
configurable | boolean | |||
currencyCode | currency | string | "USD" | This option indicates the currency is used, default value - 'en-US' |
enumerable | boolean | |||
errorCode | string | "" | ||
fullBrandColour | brand-colour | string | "" | The primary brand color in RGBA format. |
googleAccountBusinessId | google-account-business-id | string | "" | 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 |
googlePayMerchantId | google-pay-merchant-id | string | "mid_f457ac19cf41425899ff13882227da57" | This option indicates the Google Pay merchant id |
isApplePayAvailable | boolean | false | Indicates whether Apple Pay is available and rendered for the current session | |
isApplePayEnabled | is-apple-pay-enabled | boolean | true | Feature flag which indicates if Apple Payment is enabled |
isBasicStyling | data-basic-styling | boolean | true | This option hides certain UI elements (payment button, borders, padding) to provide more basic appearance for Windcave payment widget |
isGooglePayAvailable | boolean | false | Indicates whether Google Pay is available and rendered for the current session | |
isGooglePayEnabled | is-google-pay-enabled | boolean | true | Feature flag which indicates if Google Payment is enabled |
lang | data-lang | string | "en-US" | The language to use for the display text. This will determine which translated text to display. Default is 'en-US'. |
locale | locale | string | "en-US" | This option indicates the locale is used, default value - 'en-US' |
observer | any | null | MutationObserver instance It is initially set to null until an observer is assigned. | |
paymentChosen | string | The selected payment option, which could be a card, Apple Pay, or Google Pay, based on the user's choice | ||
showError | data-show-error | boolean | false | This options notifies windcave widget that transaction is not successful |
showMobileMenu | show-mobile-menu | boolean | false | A feature flag used to control the visibility of the mobile navigation menu. |
totalValue | total-value | string | "10.00" | This option indicates total value to be paid |
Events
Event |
---|
windcavePaymentError |
windcaveTransactionFinished |
windcaveWidgetLoaded |