Advanced Topics

Runtime ContextAnchorIcon

Environment VariablesAnchorIcon

You can provide your own environment variables in the generated config.yml file.
  1. yml
name: "MyFunction"
environmentVariables:
    "HTTP_TIMEOUT": 1000
    sandbox:
        "PAYMENT_URL": "https://sandbox.payments.service"
    production:
        "PAYMENT_URL": "https://payments.service"

SecretsAnchorIcon

contextArgumentAnchorIcon

Your function will be invoked with a single argument. This argument (referred to as context) is a JavaScript Object which contains both the event data specific to the trigger as well as structured Braintree metadata.
  1. JavaScript
{
  eventData: {

  },
  __metadata__: {
    environment: "production",
    invocationId: "1b3b0113-cd71-454c-b8fb-a5a52d727584",
    requestId: "076580eb-fd0d-4c69-be41-f1714f43b8be"
  }
}

eventDataAnchorIcon

See API Reference for specific data corresponding to your event. metadata
KeyTypeDescription
environmentString The Braintree environment for this function. This value will be `"sandbox"` or `"production"`
invocationIdString A uuid representing the Braintree execution of this function. This value is useful for debugging and tracing.
requestIdString A uuid representing the request that caused a function to be executed. This value is useful for debugging and tracing.

ExamplesAnchorIcon

  1. JSON
{
    "data": {

    },
    "__meta": {
        "braintreeEnvironment": "production"
    }
}