Я получаю следующую ошибку.
Что-то пошло не так , Произошла внутренняя ошибка.

Вот что я пробовал интерфейс с использованием JavaScript.
Код: Выделить всё
Link Bank Account
var linkHandler = Plaid.create({
clientName: '',
env: '', // or 'development' or 'production' based on your environment
key: '', // Replace with your Plaid public key
product: ['balance'], // or other products like 'transactions', 'balance', etc.
onSuccess: function(public_token, metadata) {
console.log('Plaid Link success!');
console.log(public_token);
console.log(metadata);
// This is where you handle the success
// Send the public_token to your backend to exchange it for an access_token
fetch('/admin/api/plaid.php', {
method: 'POST',
body: JSON.stringify({
public_token: public_token
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log('Access token received:', data.access_token);
});
},
onExit: function(err, metadata) {
console.log('Plaid Link exited');
console.log(err, metadata);
}
});
document.getElementById('link-button').onclick = function() {
console.log('Button clicked, opening Plaid Link...');
linkHandler.open();
};
Я не уверен, вызывает ли это ошибку или нет.
Мне не удалось найти много документации по Plaid и PHP.
Когда я позвонил в Plaid, они мне не помогли.
Код: Выделить всё
require 'vendor/autoload.php';
use TomorrowIdeas\Plaid\Plaid;
$plaid = new Plaid(
\getenv("PLAID_CLIENT_ID"),
\getenv("PLAID_CLIENT_SECRET"),
\getenv("PLAID_ENVIRONMENT")
);
// Get the public_token from the request body
$data = json_decode(file_get_contents('php://input'), true);
$public_token = $data['public_token'];
try {
$response = $plaid->items->get("access_token");
print_r($response);
} catch (\TomorrowIdeas\Plaid\PlaidRequestException $e) {
echo "Error: " . $e->getMessage() . "\n";
var_dump($e); // Inspect the exception object for available properties
}
$item = $plaid->items->get("itm_1234");
exit();

Подробнее здесь: https://stackoverflow.com/questions/793 ... orrowideas
Мобильная версия