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:
- A customer places an order through the BigCommerce website.
- BigCommerce communicates directly with Braintree to capture transaction details (such as the payment method) and (pre)authorizes the transaction.
- Braintree returns a transaction ID to BigCommerce.
- The integration sends the BigCommerce order details (including the Braintree transaction ID) to NetSuite.
- 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.
- Braintree returns the status of the transaction, which is saved in NetSuite.
- 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:
- Create a sandbox account in Braintree.
- Navigate to the API section.
- Click View.
- 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.
Comments
Community comment from Sara Parsons:
Answer now found at Manage Braintree GraphQL pagination.
Please sign in to leave a comment.