I am about to go live with a MEAN app onto an elastic beanstalk cloud with multiple ec2 instances so I have a problem:
At the moment, I am selling tickets to events using paypal node SDK. I do my payment.create and I pass this transaction object:
transactions: [{
amount:{
total: req.headers.amount,
currency:'AUD'
},
description:'eventID: ' + req.headers.eventid + ', userID: ' + req.headers.userid
}]
I create an associative array within my server to cache the eventid and the userid, and I used the paypal transaction ID as the key so that when paypal returns with confirmation that payment was successful I know which user and which event I need to update in my database.
If I go to cloud, if the HTTP redirect comes to a different ec2 instance this method will fail, because that associative array will be on a different machine. The ideal solution to this would be to be able to pass the eventid and userid to paypal and have them pass it back to me, is there a way to access the transaction/description data in their req callback or is there another good way to do this?
via seanEd
No comments:
Post a Comment