I'd create a HTML document with a script tag and add this URL
<script src ="https://assets.pagar.me/pagarme-js/3.0/pagarme.min.js"></script>
so, call the global variable pagarme in console browser.
I got this response:
{client: {…}, postback: {…}, company: {…}, validate: ƒ, search: ƒ, …}
But in Magento 2, I always receive error messages.
Below some files with my configuration:
requirejs-config.js
var config = {
map: {
'*': {
pagarmeJs: 'https://assets.pagar.me/pagarme-js/3.0/pagarme.min.js'
}
},
shim: {
"pagarmeJs": {
exports: "pagarme"
}
}
};
jsFileWithTheCallingCode.js - first try
define(
['pagarmeJs'],function (pagarme) {...})
jsFileWithTheCallingCode.js - second try
define(
['pagarmeJs'],function () {...})
As mentioned above, if I try to insert the pagarme variable on the console or use inside the require function I always get error messages.
Can anyone help me?