Pagos Copilot Prompting Guide

Pagos aggregates, harmonizes, and presents your payments data in complex visualizations designed to give you actionable insights for optimizing your payments strategy. Pagos Copilot makes it easier than ever to identify those insights by allowing for conversational exploration and analysis of your data. This guide provides some best practices for effectively prompting Pagos Copilot to provide you with the information and data that best suits your needs.

Prompt Best Practices

The questions or commands you give to Pagos Copilot are known as prompts. Prompts can be straightforward industry questions (e.g. “What is an issuing bank?”) or questions about your specific payments data (e.g. “What was my chargeback rate last week?”). You can also go a more direct route and tell Pagos Copliot exactly what you want to see, for example, “Show me my monthly approval rate for Visa card transactions from January until July 2024.”

However you decide to style your prompt, follow these best practices to ensure Pagos Copilot understands your needs and responds appropriately.

Include Specific Prompt Elements

When designing a prompt—especially one designed to illicit bespoke payments data visualizations—try to include some of the following elements:

  • Metric - State which common payments metric you want to see data for. Examples include approval rate, transaction count, chargeback value, etc.
  • Date range - Set a timeline for the data (e.g. November 1, 2023 - June 30, 2024). If possible, go one step further and also state how you want the data from this time period grouped. For example, broken down into monthly increments, weekly, or daily.
  • Data segment - If you don’t want to view a metric for all of your payments volume, state the specific segment you’re interested in. Use the list of filter options as a guideline. For example, you may only want transaction data for a specific payment method, card brand, customer country, or issuing bank.
  • Data Visualization Type - Specify how you want to view the data; see the section below for a list of possible data visualizations.

The first two elements—metric and date range—are the most important to include, as they ensure Pagos Copilot knows exactly where to start when searching your payments data. Data segment and data visualization type are optional, and are actually details you might not know until you start your Pagos Copilot session. For example, you may ask to see your weekly approval rate (metric) for the last 3 months (date range); if you see a dip in approvals for a particular week, you may then ask for a breakdown of your approvals by payment method type (data segment) for the problematic week.

Vague Prompt Example:

“I want to know my top performing markets.”

More Specific:

“What are my top 5 customer countries in terms of total approved transaction value this year?”

Avoid Complex Prompts

Always write your prompts using simple sentence constructions and make your instructions very explicit. Imagine you’re explaining a cooking recipe to a beginner; you want to get to the point and leave as little room for ambiguity as possible. If Pagos Copilot doesn’t provide the results you’d expect, try rewriting the prompt to use more basic and straight-forward language.

Pagos Copilot follows the context of steps within the same working session. As such, you can break complex questions into a series of small requests input individually. You may not start a session with Pagos Copilot knowing exactly what information you want, so breaking up questions in this way reflects the natural flow of a conversation. Start with a simple request, clarify your goals as you reflect on each step in the dialogue, and steer the conversation accordingly.

Example of a prompt that’s too complex:

”For the top 10 BINs with the highest attempted transaction value, chart their approval rates over the past six months, shown in a monthly graph, restricted to USA for credit card transactions only.”

The danger with this one is that Pagos Copilot may perform a query and analysis, but is more likely to make choices in setting up the analysis that don’t correspond to your intentions. Instead try the a series of prompts:

  • “In the last 6 months, what were my top 10 BINs in terms of attempted transaction value for credit cards issued in the US?”
  • “What were the approval rates for those same BINs in that time period?”
  • “Chart the monthly approval rates for those BINs over the last 6 months in a line graph, with each BIN having it's own line”

Following this thread, Pagos Copilot produced the following visualization:

Request Summaries and Recommendations

Pagos Copilot doesn't just show you data—it knows as much about payments data as the Pagos team does. If you're not sure how to summarize or explain a visual to your leadership, for example, ask Pagos Copilot for suggestions! This can be as simple as "Summarize what we learn from this data?" or "What are the top three takeaways?" The tool will respond with structured content you can copy-paste directly into communications with your team.

You can even ask Pagos Copilot for recommendations. This can be recommendations on what else you should investigate in your payments data, or suggestions for how to act on the data you've already pulled. To ensure Pagos Copilot's recommendations fit your needs, specify your end goal in your prompt. For example, if your main focus is increasing revenue or reducing fraud, include these goals in your prompt.

Pagos Copilot Data Visualizations

Pagos Copilot generates the best form of data visualizations necessary to answer your specific questions. Sometimes, this means creating a visual from scratch unlike any others available in the Pagos Service Panel. You can ask for the following visualization types:

  • Vertical bar graph
  • Horizontal bar graph
  • Stacked bar graph
  • Line graph
  • Pie chart
  • Heatmap
  • Table

The following examples demonstrate how you can use Pagos Copilot to dig into your payments data. It also showcases both the types of questions you can ask Pagos Copilot and the associated visualizations it can produce:

Example Prompt

"Show me the monthly transaction count in Canada from March 1 to June 30, 2024?"

For this example, we've included the following elements:

  • Metric: Transaction count
  • Date Range: March 1 - June 30, 2024
  • Data Segment: Customer country of Canada

Pagos Copilot remembers what data you’re digging into within a single conversation. As such, the metric, date range, and data segment are the same for any subsequent questions, and you don’t need to specify them again.

You may then want to see this data in a different way, so you ask a follow up question:

"Show me the percentage change of that data month over month."

A Technical Approach to Prompting

Behind the scenes, we use Matplotlib and Seaborn libraries to power Pagos Copilot data visualizations. If you're familiar with these Python libraries, you can write prompts to request specific formatting of the graphs Copilot returns. You can also edit the content of graphs after the fact by asking for a replot. Following our recommendations around avoiding complex prompts, you'll generally get better results by starting with a simple chart, then iterating by asking for only a few changes with each new input message (rather than trying to include every detail in a single message). Let's walk through a multi-prompt example:

Prompt A

"Plot my approval rates using a line for each stored credential, covering the past 3 months at a daily level. Use the Seaborn library theme darkgrid."

Response:

Prompt B

"Replot this up to September 1st, and remove the "unknown" category from the chart. Fix the y-axis between 80% and 100% with subticks for every percentile, but only label the even values. Make the x- and y-axis labels and the tick labels use a larger font, and ensure that the title font is 3 points larger than that. Use a linewidth of 2 units, but the same size marker. Add large open red circles around the values for card on file that fall below 91%."

Response:

Prompt C

"Display working python code that reproduces this plot exactly. Assume that the approval rate data is stored in a dataframe named df with these dates in the index and the stored credential column named stored_credential."

Response:

import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

# Assuming 'df' is your DataFrame and it already includes a 'date_time' index and 'stored_credential', 'approval_rate' columns
df['date_time'] = pd.to_datetime(df.index)  # Converting index to datetime if it's not already

# Filter to find specific "card-on-file" rates below 91%
mask_card_on_file = (
    (df['stored_credential'].str.contains('card-on-file')) &
    (df['approval_rate'] < 91)
)
card_on_file_below_91 = df[mask_card_on_file]

# Plotting the line graph with special markers for specific points
plt.figure(figsize=(14, 7))
sns.lineplot(data=df, x='date_time', y='approval_rate', hue='stored_credential', marker="o", linewidth=2)
plt.scatter(card_on_file_below_91['date_time'], card_on_file_below_91['approval_rate'], color='red', s=100, edgecolor='black', linewidth=0.7, label='Below 91%', marker='o')

# Setting the plot title and labels with specific font sizes
plt.title('Daily Approval Rates by Stored Credential', fontsize=19)
plt.xlabel('Date', fontsize=16)
plt.ylabel('Approval Rate (%)', fontsize=16)

# Formatting the ticks and limiting the y-axis
plt.xticks(rotation=45, fontsize=14)
plt.yticks(ticks=[i for i in range(80, 101)], labels=[str(i) + "%" if i % 2 == 0 else "" for i in range(80, 101)], fontsize=14)
plt.ylim(80, 100)

# Improving the readability and layout
plt.legend(title='Stored Credential', fontsize=14)
plt.grid(True, which='both', axis='y', linestyle='--', linewidth=0.5)
plt.tight_layout()

# Display the plot
plt.show()

Prompt D

"Create a similar plot where the approval rate lines use an alpha of 0.3. Then, calculate the straight line of best fit for each, ignoring the values below 91%, and overlay those lines on the plot using a solid, thick line of the same color corresponding to each type of stored credential time series. Add a box to the chart that indicates the slope of each fitted line to two significant figures."

Response:

Prompt E

Express those best fit gradients in a sentence about the rate of change of approval rate as percentage points, adjusted for time units of months instead of days.

Response:

Here are the sentences describing the rate of change of the approval rate per month for each stored credential type, based on the gradients computed earlier from the best fit lines:

  • Card-on-file-repeat: The approval rate is increasing at a rate of approximately 0.207 percentage points per month.
  • Card-on-file-vault: The approval rate is decreasing at a rate of approximately -0.573 percentage points per month.
  • One-time: The approval rate is increasing at a rate of approximately 0.318% percentage points per month.

These rates of change are calculated by converting the daily gradient to a monthly gradient, assuming about 30 days per month. For example, a daily change of (0.0069%) would correspond to (0.0069% \times 30 \approx 0.207%) per month.