So, i'm trying to create a button
<div id="coinbasetest" class="coinbase-button" data-code="6ad16caf532b5d802a1141766ee4d823" data-button-style="none"></div><script src="https://www.coinbase.com/assets/button.js" type="text/javascript"></script>
(This is just a temporarily div), I replace the "data-code" attribute with another value through ajax and php script. The problem is, when i replace it, it doesn't work. It says it can't find the model.. and it CLEARLY matches up
See image for console log: https://i.stack.imgur.com/diCOs.png
Ajax:
success: function(response) {
var test = document.getElementById('coinbasetest');
test.setAttribute("data-code", response.buttonCode);
console.log(test);
$(document).trigger('coinbase_show_modal', response.buttonCode);
If I just replace the data-button with a "static" one, it seems to work but the data-code is not static because my checkout depends on what the other users decide to purchase!
After adding the coinbase-button class, the only required parameter is data-code which hard codes the name, price, and description fields (these are set at the time the button is created and cannot be changed later).
Apparently they can't be changed afterwards for some reason, anyone know why?