Native version
Request address and request parameters for opening cashier in Native version
Opening the cashier in the native version
Include a file in html
The project uploads our script from the cash register server along with its main JS bundle
<script src="https://merchant.com/static/cash-react/build/js/cashier2.0.js?v=${Date.now()}"></script>
After which a global Cashier object is created with which all further work will take place.
Cashier initialization
When starting a project, you need to initialize (download the main bundle) the cash register by running:
Cashier.Init({
Domain: "https://merchant.com",
cashierMode: "general",
defaultTheme: themeName,
frames: {
parent: window
},
unicKey: cashierToken
});
Cashier.Init(config)
is getting called only 1 time per session!
Await response
The project is waiting for a postMessage from the cash register:
event="@cashier_iframe_init_success"
Cashier display
To display the cashier, this method must be called:
Cashier.Render(root) // where root is a link to the DOM element where the cashier should be placed.
Available methods
Cashier.ChangeCurrency(domain, unicKey);
Chashier.ChangeLanguage(unicKey, language);
Change theme
To change the theme on the fly. Can be used when changing the theme of a project from dark to light
Cashier.ChangeTheme(theme);
Event listener to resize checkout window
window.addEventListener('message', (e) => {
if (e?.data?.action_info?.width) {
const {width, height} = e.data.action_info
widget.width = width;
widget.height = height;
}
})
Request parameters
site_id
Yes
integer
Site identifier in the system
3327
amount
Yes
integer
Amount to be paid in minor units, e.g. for USD - in cents.
100
currency
Yes
alpha-3 ISO 4217
Withdrawal currency
GBP
external_id
Yes
string(256)
Unique order identifier in the Merchant's system
AA00033
site_login
Yes
varchar(256)
User's site login
user_test
customer_ip
Yes
inet (ipv4 or ipv6) string
Ip for the authorization
8.8.8.8
display_payment_group_id
Yes
integer
Payment group, by which the User is going to withdraw funds
17
invoice_id
Yes
integer
Invoice ID in a cashier (in the request_payout)
3921556
cashier_render
No
WithdrawPageFirst: bool
Specifies the initial page of the cash register
Cashier.Render(root, { withdrawPageFirst: true })
user_preset_id
No
integer
Preset ID
101
comment
No
string(4096)
Comment to the request
example_comment
country_code
No
String(256)
User's country
GB
signature
Yes
SHA-1
Request signature, see Request signature generating rules
d9f5713990de5c6e32169dba1f0102f540018975
Last updated