• English日本語한국어
  • Log inStart now

Stripe integration

Monitor your Stripe application in a single, pre-built Stripe dashboard that tracks metrics like transaction overview, transaction volume, revenue, and transaction errors. Simply install our agents to collect your app data, and you'll be able to see all of your Stripe app data in one place.

View all your Stripe app's metrics in one dashboard.

Set up Stripe monitoring

Step 1 of 6

Install the infrastructure agent

Install our infrastructure agent to get details about your host, such as CPU usage, memory usage, storage usage, network traffic, and more.

To install the agent, follow the guided install or see the Infrastructure agent installation docs to install manually.

Step 2 of 6

Install an APM agent

Install one of our application performance monitoring (APM) agents in the guided install.

Step 3 of 6

Install our browser monitoring agent

Our browser monitoring agent reports application and browser-related metrics like AJAX performance, error rate, duration, core web vitals, and throughput.

Step 4 of 6

Set up synthetic monitoring

Our synthetic monitors test your app in different locations and capture server downtime. You can view this data in the Stripe dashboard.

To set up synthetic monitors, follow the steps in our guided install

Step 5 of 6

Send metrics to New Relic

Check the Metric API documentation for further details.

To proceed further, you will need a New Relic license key. See New Relic API Keys to get your license key. On a successful stripe payment, we receive a JSON from the stripe API service. We need to send these values to New Relic by formatting the JSON as per New Relic Metric API requirements.

The following JavaScript code snippet formats the data and sends it to the New Relic metric API URL:

const sendDataToNewRelic = (sessionJSON) => {
const currentDate = new Date();
const currentTime = currentDate.getTime();
const nrMetrics = [{
"metrics": [
{
"name": "stripe_metrics",
"timestamp": currentTime,
"value": 0,
"attributes": {
"stripe.session_id": sessionJSON.id,
"stripe.amount_total": sessionJSON.amount_total,
"stripe.customer_email": sessionJSON.customer_details.email,
"stripe.created_at": sessionJSON.created,
"stripe.currency" : sessionJSON.currency,
"stripe.payment_status": sessionJSON.payment_status,
"stripe.status": sessionJSON.status,
"stripe.discount_amount":sessionJSON.total_details.amount_discount,
"stripe.shipping_amount":sessionJSON.total_details.amount_shipping,
"stripe.tax_amount":sessionJSON.total_details.amount_tax
}
}
]
}]
const nrMetricAPI = 'https://metric-api.newrelic.com/metric/v1'
axios({
url: nrMetricAPI,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Api-Key': 'LICENSE_KEY'
},
data: JSON.stringify(nrMetrics)
})
.then((response) => {
// Handle the response here if needed
console.log('Metrics data sent successfully:', response.data);
})
.catch((error) => {
// Handle any errors that occur during the request
console.error('Error sending metrics data to New Relic:', error);
})
}

Note: Change the sessionJSON according to your response and call this function where you are getting Stripe metrics in your application.

sendDataToNewRelic (session)
Step 6 of 6

Install our Stripe monitoring dashboard

To set up our pre-built Stripe dashboard to monitor your application metrics, go to the Stripe dashboard installation and follow the instructions. Once installed, the dashboard should display metrics.

What's next?

Use NRQL to query your Stripe app data. For example, if you want to view net revenue obtained from Stripe, try this query in the Query Finder:

SELECT stripe.amount_total FROM Metric WHERE metricName = 'stripe_metrics'

To learn more about building NRQL queries and generating dashboards, check out these docs:

  • Introduction to the query builder to create basic and advanced queries.
  • Introduction to dashboards to customize your dashboard and carry out different actions.
  • Manage your dashboard to adjust your display mode, or to add more content to your dashboard.
Copyright © 2023 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.