I’m navigating a website from Google Wallet for digital goods in a strip and I’m trying to duplicate an old stream
Customer makes a purchase and user_id , product_id , quantity and other arbitrary data are transferred to Google Wallet
A postback is sent to my server, including all this extra data and a secret key, so I know that this is not a client cheating on the postback
My server assumes that this means that a legitimate purchase has taken place and is completing various processing
For every purchase, my site obviously needs to know
- Which product was purchased (and
charge.description cannot be used as a unique identifier) - Which of the user accounts of your site was registered by the client when making a purchase.
I am trying to integrate Checkout and cannot see
Use client object?
The customer object does not look like a solution, as the API docs say: “Customer objects allow you to make recurring payments and track multiple charges associated with the same customer,” none of which apply to my situation.
Handle it in a local Javascript callback?
I can do something like this
var handler = StripeCheckout.configure({ token: function(token) { var user_id = 123; var product_id = 456; var quantity = 2; var arbitrary = 'data';
But the Checkout example says that the token callback is called “when the verification process is complete”, and not just for successful collections. token.id can be saved along with other data in the form of a “pending purchase”, which will be checked after the charge.succeeded event triggers a web check, but this can lead to a race condition, a sound minimized as hell, and token.id isn’t sent back by webcam first.
This seems like a really common requirement for processing payments, but I'm completely puzzled by how to practically pull it out with Stripe. Can anyone advise?
source share