availability

We're building functions with the same proven expertise and rock solid foundations you expect from Braintree. Take a look at our documentation preview to get a jump start on what you'll make with functions.

Email functions-requests@braintreepayments.com to learn more.

Runtime Context

Environment Variables

You can provide your own environment variables in the generated config.yml file.

yml
name: "MyFunction"
environmentVariables:
  "HTTP_TIMEOUT": 1000
  sandbox:
    "PAYMENT_URL": "https://sandbox.payments.service"
  production:
    "PAYMENT_URL: "https://payments.service"

Secrets

context Argument

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.

JavaScript
{
  eventData: {

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

eventData

See API Reference for specific data corresponding to your event.

metadata

Key Type Description
environment String The Braintree environment for this function. This value will be "sandbox" or "production"
invocationId String A uuid representing the Braintree execution of this function. This value is useful for debugging and tracing.
requestId String A uuid representing the request that caused a function to be executed. This value is useful for debugging and tracing.

Examples

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

Next Page: Packaging and Publishing →