Skip to content
A Lambda function for charging cards with Stripe
JavaScript
Branch: master
Clone or download
TaylorBriggs Merge pull request #11 from TaylorBriggs/fix/grunt-build-event
Add stripe test key to env for grunt build event task
Latest commit 01dafbf Mar 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Add stripe test key to env for grunt build event task Mar 29, 2018
tasks Add stripe test key to env for grunt build event task Mar 29, 2018
.env.sample Add stripe test key to env for grunt build event task Mar 29, 2018
.gitignore Auto deploy functionnality using grunt Apr 4, 2016
.npmignore Add files and directories generated by grunt to npmignore Nov 8, 2017
.nvmrc Use node version available on AWS Oct 9, 2015
Gruntfile.js
LICENSE Initial commit Oct 6, 2015
README.md Auto deploy functionnality using grunt Apr 4, 2016
index.js Update handler signature to match node v4+ runtime Nov 8, 2017
package.json Bump grunt-aws-lambda to 0.13.0 Oct 18, 2017

README.md

Stripe Lambda

A Lambda function for charging cards with Stripe. Only intended for use with the Stripe Checkout widget.

Authentication

Set your Stripe secret key in the .env file. Copy the sample to get started:

$ cp .env.sample .env

Test your code locally

Use the script to create your zip archive:

$ grunt run

Test and Package your code in a zip

$ grunt package

Deploy the code

Option 1 : Deploy it manually

Connect to AWS account and deploy it manually

Option 2 : deploy automatically on amazon aws

$ grunt deploy

You would need to fill the following informations in your .env file :

AWS_ACCOUNT_ID={{YOUR_AWS_ACCOUNT_ID}}
AWS_REGION={{YOUR_AWS_REGION}}
AWS_FUNCTION_NAME={{YOUR_AWS_FUNCTION_NAME}}

Integrate

Integrate with the AWS API Gateway to access the function via HTTP POST:

$ curl -X POST -H "Content-Type: application/json" \
-d '{ "amount": 5000, "source": "STRIPE_SOURCE" }' \
YOUR_API_GATEWAY_URL

There is also an optional receipt_email param. See the Stripe docs for additional details on creating a charge.

You can’t perform that action at this time.