Articles in this section

Connect to the Braintree GraphQL API

This article explains how to connect to the Braintree Graph QL API.

Note

Since this article is focused primarily on Braintree, the steps necessary to set up ERP/order management have been left out. In fact, you can substitute the destination endpoint in this example (NetSuite) with any similar app.

The following diagram illustrates a typical eCommerce order-to-cash transaction, automated by an integrator.io flow:

  1. A customer places an order through the BigCommerce website.

  2. BigCommerce communicates directly with Braintree to capture transaction details (such as the payment method) and (pre)authorizes the transaction.

  3. Braintree returns a transaction ID to BigCommerce.

  4. The integration sends the BigCommerce order details (including the Braintree transaction ID) to NetSuite.

  5. Once the order is ready to be fulfilled (indicated by a Pending Fulfillment status), NetSuite obtains payment from the customer by sending a request to Braintree to submit the transaction for settlement.

  6. Braintree returns the status of the transaction, which is saved in NetSuite.

  7. If the request is successful and the status of the transaction is SETTLED, then the order is fulfilled. If the request is unsuccessful or the status of the transaction is something other than SETTLED, then the order is not fulfilled.

You can extrapolate these concepts for other contexts, such as refunds.

360066343672-order-to-cash.png

Create a Braintree sandbox account

Use the following steps to replicate this scenario:

image idm46231118258208
  • Navigate to the API section.

image idm46231118253616
  • Click View.

image idm46231118249024

Public key not shown

  • Save the public and private API keys, as well as the merchant ID.

image idm46231118244432

Create a connection to Braintree

Open a token-based HTTP connection with the following settings:

  • Name: Braintree GraphQL (or something else meaningful to you)

  • Mode: Cloud

  • Authentication type: Token

  • Configure HTTP headers:

     Content-Type: application/json
    Braintree-Version: 2020-05-07
  • Base URI: https://payments.sandbox.braintree-api.com/graphql

  • Media type: JSON

  • Token: BASIC : PUBLIC_KEY:PRIVATE_KEY

    Encode the following sequence with base64 encoding:

     PUBLIC_KEY:PRIVATE_KEY

Send token

  • Location: Header

  • Scheme: Bearer

Test the connection

Define the parameters as follows to test the connection.

  • Ping Method: POST

  • Ping Body: { "query": "query { ping }" }

Create an integration flow that imports to Braintree

image idm46231118239840

Define the import to Braintree as follows:

  • Name: Braintree - Capture Transaction

  • Input mode: Records

  • Method: POST

  • Request Media Type: JSON

  • Response ID path: (for example, /data/transaction/id)

  • Error path: /errors

  • Success media type: JSON

  • Error media type: JSON

At this point, you should be able to test your flow.