遵循 Stripe 网站上的格子集成教程后,我无法使格子链接正常工作。
我试图用环境键替换“env”和“key”变量,如下所示:
<button id='linkButton'>Open Plaid Link</button>
<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js">
</script>
<script>
var linkHandler = Plaid.create({
env: ENV['PLAID_ENV'],
clientName: 'Divco',
key: ENV['PLAID_PUBLIC_KEY'],
product: ['auth'],
selectAccount: true,
onSuccess: function(public_token, metadata) {
// Send the public_token and account ID to your app server.
console.log('public_token: ' + public_token);
console.log('account ID: ' + metadata.account_id);
},
onExit: function(err, metadata) {
// The user exited the Link flow.
if (err != null) {
// The user encountered a Plaid API error prior to exiting.
}
},
});
// Trigger the Link UI
document.getElementById('linkButton').onclick = function() {
linkHandler.open();
};
当我放弃“花哨”的环境变量,直接插入我的密钥时,我没有问题。我觉得我打错了一些东西……但为了我的生活,我找不到它。