• EnglishEspañol日本語한국어Português
  • 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

Install an APM agent

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

Install our browser monitoring agent

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

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

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)

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:

Copyright © 2024 New Relic Inc.

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