Stripe payment API (NodeJS snippet)
✓ Published0🌍 Public
Aamazingandyyy
Last edited Oct 4, 2016
Created on Oct 4, 2016
This example demonstrates a server-side payment charge using the Stripe payment API, executed through a Node.js snippet. The code initializes the Stripe client with a secret key from environment variables and then calls `stripe.charges.create` to process a transaction. It specifies an amount of 50 dollars (converted to cents), sets the currency to USD, and passes a Stripe token as the payment source, along with a description that includes a user ID. The snippet relies on the `stripe` npm library and accesses data from an external object (`dataObj`), but does not show the actual HTTP request or response handling.
AI-generated description