I've got Plaid payment initiation working on my cart but for some reason, all payments have the status of "PAYMENT_STATUS_INPUT_NEEDED".
Also, I can only get Plaid to work if "receivedRedirectUri" is omitted when making the "plaid.Create" call. If I include it, Plaid throws the following error:
display_message: null
documentation_url: "https://plaid.com/docs/?ref=error#invalid-request-errors"
error_code: "INVALID_FIELD"
error_message: "oauth_continuation.link_token does not match session"
error_type: "INVALID_REQUEST"
request_id: "aseWi7KyiQwxuVE"
suggested_action: null
Has anyone come across this? Plaid's docs don't seem to cover this. This is what my function looks like.
async plaidPay() {
let amount = this.cart[0].item.amount * this.cart[0].quantity;
console.log(window.location.href);
const linkToken = await this.$axios({
method: 'post',
url: 'api/plaid-create-payment',
data: { amount: amount },
config: { headers: { 'Content-Type': 'application/json' }}
})
.then(res => {
return res.data.link_token;
})
.catch(e => {
console.log(e)
})
console.log(linkToken);
const handler = window.Plaid.create({
token: linkToken,
onSuccess: (public_token, metadata) => {
console.log('test 1');
console.log(public_token);
console.log(metadata);
},
onLoad: () => {
console.log('test 2');
},
onExit: (err, metadata) => {
console.log('test 3');
console.log(err);
console.log(metadata);
},
onEvent: (eventName, metadata) => {
console.log('test 4');
console.log(eventName);
console.log(metadata);
},
//required for OAuth; if not using OAuth, set to null or omit:
receivedRedirectUri: window.location.href,
});
handler.open();
}
I think this question is being handled by Plaid support, but for posterity and the benefit of those Googling, the issue seems to be that you are launching with receivedRedirectUri
the first time you launch Link. This field should only be included when reinitializating Link, after returning from the OAuth flow.