Skip to content

TaylorBriggs/stripe-relay-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stripe-relay-lambda

A Lambda function for creating customers and orders to complete a Stripe Relay flow.

Authentication

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

$ cp .env.sample .env
$ sed -i '' "s/<YOUR_SECRET_KEY>/$SECRET_KEY/g" .env

Usage and Deployment

Use the script to create your zip archive:

$ npm run zip

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

$ curl -X POST -H "Content-Type: application/json" \
-d '{ \
  "source": $SOURCE, \
  "email": "[email protected]", \
  "parent": $SKU_ID, \
  "shipping": { \
    "name": "John Doe", \
    "address": { \
      "line1": "123 Fake St.", \
      "city": "New York", \
      "state": "NY", \
      "postal_code": "10001" \
    } \
  } \
}' \
$API_GATEWAY_URL

Obtain the source using Checkout and the parent from the Stripe API, or stripe-products-lambda.

It returns an error, if one is present, or the order object under the root key of order:

{
  "order": {
    ...order details
  }
}

About

A Lambda function for creating Stripe orders

Resources

License

Stars

Watchers

Forks

Packages

No packages published