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.

Create a Braintree sandbox account

Use the following steps to replicate this scenario:

  1. Create a sandbox account in Braintree.
  1. Navigate to the API section.
  1. Click View.
Public key not shown
  1. Save the public and private API keys, as well as the merchant ID.

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

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.

Additional Braintree GraphQL API resources

Was this article helpful?
0 out of 0 found this helpful

Comments

1 comment
Date Votes
  • Community comment from Sara Parsons:

    Hello, 

    Any updates to the pagination issue with GraphQL?  I'm looking to integrate two APIs, one is REST and the other is Graph.  When I receive multiple pages of results, I'm having trouble figuring out how to configure pagination to get the next page's worth of information.

    Answer now found at Manage Braintree GraphQL pagination.

     

    0

Please sign in to leave a comment.