Banking über Plaid TomorrowIdeas kann nicht verbunden werdenPhp

PHP-Programmierer chatten hier
Guest
 Banking über Plaid TomorrowIdeas kann nicht verbunden werden

Post by Guest »

Ich versuche, mein Bankkonto mit Plaid zu verbinden.
Ich erhalte die folgende Fehlermeldung.
Etwas ist schief gelaufen , Interner Fehler aufgetreten.
Image

Hier ist, was ich versucht habe Frontend mit Javascript.

Code: Select all

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();
};


Hier ist die Datei, die versucht, „plaid.php“ abzurufen.
Ich bin mir nicht sicher, ob dies den Fehler verursacht oder nicht.
Ich konnte nicht viel Dokumentation zu Plaid und PHP finden.
Als ich Plaid anrief, waren sie überhaupt nicht hilfreich.

Code: Select all

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();

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post