npm install hapi-gocart
var GOCart = require('hapi-gocart')
server.register({
register: GOCart,
options: options,
}, function (err) {})
-
corsOrigins
[String]
Sets the CORS headers for your routes. Default
['*']
. -
schemaUri
String
The URI for the gocart schema. Required.
-
stripeSecretKey
String
The Stripe secret key. Required.
See LICENSE.
A JSON schema utility for GOCart.
npm install gocart-schema
var schema = require('gocart-schema')
var validation = schema.validate(yourObj)
validation.value // the result (with defaults populated)
validation.error // the error (`null` if `yourObj` is valid)
This is the root object for the specification.
Field Name | Type | Description |
---|---|---|
info | Info Object | Required. |
products | Products Object | Required. |
server | Server Object | Required. |
stripe | Stripe Object | Required. |
Defines additional data about the store.
Field Name | Type | Description |
---|---|---|
name | String |
Required. |
description | String |
Field Pattern | Type | Description |
---|---|---|
^x- | Any |
Field Pattern | Type | Description |
---|---|---|
{id} | Product Object | Required. |
Defines a product. In addition to the subset specified below, can contain the types specified in Stripe Object (these values will override the global Stripe configuration).
Field Name | Type | Description |
---|---|---|
amount | Number |
Required. |
description | String |
|
images | [String] |
|
metadata | Any | |
name | String |
|
plan | String |
Field Pattern | Type | Description |
---|---|---|
^x- | Any |
Defines the GOCart server configuration.
Field Name | Type | Description |
---|---|---|
host | String |
Required. |
pathname | String |
Defines the global Stripe configuration. Values can be overriden by individual Product Objects.
Field Name | Type | Description |
---|---|---|
allowRememberMe | Boolean |
|
billingAddress | Boolean |
|
bitcoin | Boolean |
|
capture | Boolean |
|
currency | String |
|
image | String |
|
name | String |
|
panelLabel | String |
|
publishableKey | String |
Required. |
receiptEmail | Boolean |
|
shippingAddress | Boolean |
billingAddress must be set to true . |
zipCode | Boolean |
See LICENSE.
The core GOCart service.
npm install gocart-service
var handleRequest = require('gocart-service')(yourStripeSecretKey, yourSchemaUri)
handleRequest(payload).then(function (res) {})
The shape of the payload
object is specified in lib/validate.
See LICENSE.