Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.38 KB

README.md

File metadata and controls

59 lines (46 loc) · 1.38 KB

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": "test@example.com", \
  "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
  }
}