Skip to content

Instantly share code, notes, and snippets.

@edumaciel10
Created January 31, 2022 15:32
Show Gist options
  • Save edumaciel10/66e5dd99bc28e5744a254e227d6e11b0 to your computer and use it in GitHub Desktop.
Save edumaciel10/66e5dd99bc28e5744a254e227d6e11b0 to your computer and use it in GitHub Desktop.
It's a simple openpix plugin implementation
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<title>Demo OpenPix Plugin</title>
</head>
<body>
<div id="root"></div>
<script src="https://plugin.openpix.com.br/v1/openpix.js" async></script>
<button id="newChargeButton">Click here to create a new charge</button>
<script>
document.getElementById('newChargeButton').addEventListener('click', function() {
window.$openpix = window.$openpix || []; // priorize o objeto já instanciado
window.$openpix.push(['config', { appID: 'your-app-id' }]);
window.$openpix.push([
'pix',
{
value: 1, // R$ 10,00
correlationID: 'test',
description: 'test',
},
]);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment