Checkout widget integration

You can either create your own payment button(s) with the js-checkout-widget-btn CSS class and include the script, or just include the script where you want a button to be created.

Checkout widget requires SAQ A.

<script
    src="https://checkout.crassula.io/v1/checkout.js" async class="js-checkout-widget"
    data-project="d55ad89070d6172cc0eeeecfdde2c554"
    data-user="1"
    data-display-name="Demo Name"
    data-price="20"
    data-currency="EUR">
</script>

The default button creation can be disabled with the data-config-create-button="false" attribute.

To open the checkout widget programmatically use the Pay.Api.Checkout.open(parameters) method.

Pay.Api.Checkout.open({
    'price': 5,
    'currency': 'EUR'
});

Checkout widget events can be used by calling the Pay.Api.Checkout.on(event_name, callback) method. Supported events are: open, success, fail, close.

Pay.Api.Checkout.on('open', function() {
    console.log('Opened!');
});

Available parameters

When using data- attributes use dashes (-) instead of underscores (_) in parameter names.

project
required
Public key of your project.
user
required
Unique and unchangeable identifier of a user.
display_name
optional
Full name of nickname of a user.
email
optional
Email address of a user.
phone
optional
Phone number of a user in international format, without the leading + and any separators.
price
optional, either price, amount or package is required
Integer or float number representing payment price.
currency
required if price is provided
Three letter currency code in ISO 4217 format.
amount
optional, either amount, price or package is required
Amount of virtual currency. Only available if virtual currency exchange rates are configured.
package
optional, either package, price or amount is required
Identifier of a virtual currency package.
package_set
optional
Key of a virtual currency package set.
payment_method
optional, default is "credit_card"
Key of a payment method to offer by default.
additional_methods
optional
Integer (1 or 0) indicating whether to display additional payment methods.
locale
optional, default is project’s locale
Locale of a user in ISO 639-1 format.
ip
optional
IP address of a user.
order_id
optional
Merchant’s order ID that will be returned back in a callback.
description
required
Description of a payment.
success_url
optional
URL where the user must be redirected after a successful payment.
fail_url
optional
URL where the user must be redirected after an unsuccessful payment.
attr_*
optional
Any custom attributes, that you want to be returned in a callback. For example: attr_realm, attr_server, attr_landing.
signature
required if enabled in project settings
See the Authentication section of the API Reference.

Callbacks

For information on callbacks please visit the Callbacks section of the API Reference.

REST API integration

For REST API integration guide please visit the API Reference.

Test cards

Test cards are accepted only when project is in sandbox state.

Expiration date must be grater than the current month. Any security code is valid.

MasterCard

5444870724493746
5401030603708505
6777060877427221 (maestro, 3d only)
5421590824439145

VISA

4012001037141112
4012001037167778
4012001038488884 (non 3d card, unable to verify enrollment)