Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TaylorBriggs/stripe-lambda
A Lambda function for charging cards with Stripe
https://github.com/TaylorBriggs/stripe-lambda
Last synced: about 2 months ago
JSON representation
A Lambda function for charging cards with Stripe
- Host: GitHub
- URL: https://github.com/TaylorBriggs/stripe-lambda
- Owner: TaylorBriggs
- License: mit
- Created: 2015-10-06T05:09:18.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T17:28:00.000Z (over 6 years ago)
- Last Synced: 2024-07-02T08:18:16.083Z (4 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 160
- Watchers: 6
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-serverless - Stripe Lambda function - A Lambda function for charging cards with Stripe. (Payments)
README
# Stripe Lambda
A Lambda function for charging cards with Stripe. Only intended for use with the [Stripe Checkout](https://stripe.com/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 locallyUse 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](http://docs.aws.amazon.com/lambda/latest/dg/gs-amazon-gateway-integration.html)
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](https://stripe.com/docs/api#create_charge) for additional
details on creating a charge.