Skip to content

Commit

Permalink
fixup! DOC-454 add enrichment to card transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
clywyk committed Jun 18, 2024
1 parent e82b319 commit 0fc8383
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 99 deletions.
8 changes: 7 additions & 1 deletion docs/developers/using-api/webhooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,23 @@ The first part of the `eventType` will tell you what resources to query in an AP
| `MerchantProfile.Created` | Merchant profile was created |
| `MerchantProfile.Updated` | Merchant profile was updated |

### [Payments and transactions](../../topics/payments/index.mdx) {#events-payments-transactions}
### [Payments](../../topics/payments/index.mdx) {#events-payments}

| `eventType` | Explanation |
| --- | --- |
| `ReceivedDirectDebitMandate.Created` | Received direct debit mandate was created either through the API or automatically by Swan |
| `ReceivedDirectDebitMandate.Updated` | Received direct debit mandate was updated |
| `StandingOrder.Canceled` | Standing order was canceled |
| `StandingOrder.Scheduled` | Standing order was scheduled |

### [Transactions](../../topics/payments/index.mdx#transactions) {#events-transactions}

| `eventType` | Explanation |
| --- | --- |
| `Transaction.Booked` | Transaction was completed and will appear on the account statement |
| `Transaction.Canceled` | Upcoming direct debit was canceled |
| `Transaction.Deleted` | Scheduled direct debit was deleted |
| `Transaction.Enriched` | [Enriched transaction information](../../topics/payments/cards/index.mdx#enriched) was received for a card transaction outside of a status update |
| `Transaction.Pending` | Outgoing SEPA Credit Transfer was processed and is waiting for the next SEPA batch, a card authorization was accepted, and more |
| `Transaction.Rejected` | Transaction was rejected for compliance reasons |
| `Transaction.Released` | Transaction was released |
Expand Down
Binary file modified docs/images/topics/payments/cards/card-enriched-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 42 additions & 75 deletions docs/topics/payments/cards/guide-get-enriched-info.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,54 @@ title: Get enriched information about card transactions

# Get enriched information about card transactions

You can **call the API** to get enriched information about card transactions.

Enriched transaction information is also available on your **Dashboard** > **Data** > **Transactions**, as well as Swan's Web Banking interface if you're using it.
You can **call the API** to get [enriched information about card transactions](./index.mdx#enriched).
Enriched information is also available on your Dashboard by going to **Data** > **Transactions** > **Details**.

:::tip Prerequisites
You need a **project access token** to call the query.
:::

## Guide {#guide}

1. Call the `card` query.
1. Add the card ID.
1. Add `transactions`.
1. Add all information you'd like to review about each card transaction.
1. Add [pagination](../../../developers/using-api/pagination.mdx#arguments) if you're expecting a long list.
1. Call the `transaction` query.
1. Add the transaction ID.
1. Add `CardTransaction`, then `enrichedTransactionInfo`.
1. Choose all the enriched information you'd like to review about the card transaction.

## Query {#query}

🔎 [Open the query in API Explorer](https://explorer.swan.io?query=cXVlcnkgTGlzdENhcmRUcmFuc2FjdGlvbnMgewogIGNhcmQoY2FyZElkOiAiJFlPVVJfQ0FSRF9JRCIpIHsKICAgIHRyYW5zYWN0aW9ucyB7CiAgICAgIGVkZ2VzIHsKICAgICAgICBub2RlIHsKICAgICAgICAgIC4uLiBvbiBDYXJkVHJhbnNhY3Rpb24gewogICAgICAgICAgICBpZAogICAgICAgICAgICBjYXRlZ29yeQogICAgICAgICAgICBsYWJlbAogICAgICAgICAgICBzdGF0dXNJbmZvIHsKICAgICAgICAgICAgICBzdGF0dXMKICAgICAgICAgICAgfQogICAgICAgICAgICB0eXBlCiAgICAgICAgICAgIGFtb3VudCB7CiAgICAgICAgICAgICAgY3VycmVuY3kKICAgICAgICAgICAgICB2YWx1ZQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBwYXltZW50SWQKICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9Cn0K&tab=api)
🔎 [Open the query in API Explorer]

<mark>GET QUERY FROM PREPROD WHEN AVAILABLE</mark>

```graphql {2,6} showLineNumbers
query ListCardTransactions {
card(cardId: "$YOUR_CARD_ID") {
transactions {
edges {
node {
... on CardTransaction {
id
category
label
statusInfo {
status
}
type
amount {
currency
value
}
}
paymentId
}
```graphql {2,3,12} showLineNumbers
query MyQuery {
transaction(id: "$TRANSACTION_ID") {
... on CardTransaction {
id
merchantCategoryCode
merchantCategoryDescription
merchantCity
merchantCountry
merchantId
merchantPostalCode
merchantName
enrichedTransactionInfo {
enrichedMerchantName
logoUrl
category
subcategory
country
city
address
longitude
latitude
postalcode
isSubscription
carbonFootprint
contactEmail
contactPhone
contactWebsite
}
}
}
Expand All @@ -53,50 +60,10 @@ query ListCardTransactions {

## Payload {#payload}

Review these two card transactions for an eCommerce purchase: the authorization and the final payment.
Each transaction has its own transaction ID (lines 8, 24) but share the same payment ID (lines 19,35)
:::note Other
When new values aren't mapped yet, they're marked `Other`.
:::

```json {2} showLineNumbers

```json {8,19,24,35} showLineNumbers
{
"data": {
"card": {
"transactions": {
"edges": [
{
"node": {
"id": "decao_14fd19a4320c78b9aa7716940530604f",
"category": "eCommerce",
"label": "Book purchase",
"statusInfo": {
"status": "Booked"
},
"type": "CardOutDebit",
"amount": {
"currency": "EUR",
"value": "15.00"
},
"paymentId": "cro_50680a1bfb6590742056a3d257c54b76"
}
},
{
"node": {
"id": "aucao_455c6e1d97ed66fcff868e09c87dd313",
"category": "eCommerce",
"label": "Book purchase",
"statusInfo": {
"status": "Released"
},
"type": "CardOutAuthorization",
"amount": {
"currency": "EUR",
"value": "0.00"
},
"paymentId": "cro_50680a1bfb6590742056a3d257c54b76"
}
},
]
}
}
}
}
```
46 changes: 24 additions & 22 deletions docs/topics/payments/cards/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -353,45 +353,47 @@ participant CM as Card holder's mobile device

## Enriched transaction information {#enriched}

When reviewing their transaction history, card holders can see enrichedmore detailed—information about the merchant and the transaction.
You can also view the information on your Dashboard and retrieve it with the API.
When reviewing their transaction history, **card holders** can see **enriched information** (more detailed data) about the merchant and the transaction.
Providing enriched transaction information **improves the user experience** for you and your users by reducing chargebacks and decreasing the need for customer support.

Providing enriched transaction information improves the user experience for you and your users by reducing chargebacks and decreasing the need for customer support.

Swan enriches all card transactions with additional merchant data, including:
You can retrieve this information with the API and view it on your Dashboard by going to **Data** > **Transactions** > **Details**.
If you use Swan's Web Banking interface, enriched transaction information is available for your users automatically in their History list.
Enriched transaction information is **only available for card transactions**.

1. Merchant brand name (`brand_name`)
1. Merchant logo (`brand_logo`)
1. Merchant category (`category`)
1. Merchant subcategory (`subcategory`)
1. Subscription indicator (`is subscription` boolean)
1. Merchant contact details (`contact_email`, `contact_phone`, and `contact_website`)
1. Carbon footprint (measured in micrograms) (`emission_in_ug`)
Swan enriches card transactions with the following data (as availability allows):

On your Dashboard, go to **Data** > **Transactions** > **Details** to view enriched transaction information.
If you use Swan's Web Banking interface, enriched transaction information is available for your users automatically in their History list.
| API | Description | Example |
| --- | --- | --- |
| `brand_name` | Merchant brand name | Carrefour |
| `brand_logo` | Merchant logo | Small image of the merchant's logo, or, if no logo is available, the category icon |
| `category` | Merchant category | Groceries |
| `subcategory` | Merchant subcategory | Supermarket |
| `is subscription` | Subscription indicator boolean | `Yes` or `No` |
| `contact_email`<br />`contact_phone`<br />`contact_website` | Merchant contact details | example[@]carrefour.fr<br />05.00.55.00.55<br />carrefour.fr |
| `emission_in_ug` | Carbon footprint, measured in micrograms | 546 grams |

:::info
Enriched transaction information is currently only available for card payments.
:::caution Back-filling transaction info
Swan plans to backfill enriched transaction information so you can display it to your users.
If you integrate enriched transaction information, fields will be empty for transactions that aren't backfilled yet.
:::

### Displaying enriched info {#enriched-display}

In the API and on your Dashboard, `enrichedTransactionInfo` doesn't override the existing merchant information received during the classic transaction flow.
If you use Swan's Web Banking interface, however, the enriched information overrides the merchant name.

Consider the following Dashboard content for a card transaction:
The following image is sample enriched information as displayed on the Dashboard:

![Example of enriched card transaction information on the Dashboard](../../../images/topics/payments/cards/card-enriched-dashboard.png)

:::caution Back-filling transaction info
We must plan to back-fill all our transactions since the 1st day of Swan (5M+ transactions), warn Triple, and do it little by little etc. Important for partners to be able to display data fields for a user.
### Webhooks & enriched info {#enriched-webhooks}

:::
Swan obtains enriched transaction information **asynchronously** to avoid processing delays and technical timeouts.

### Webhooks & enriched info {#enriched-webhooks}
- If enriched information is received when a transaction's status changes, only the `Transaction.Pending` webhook is triggered.
- If enriched information is received outside of a transaction status update, Swan triggers the `Transaction.Enriched` webhook. In the `Transaction.Enriched` webhook notification, the resource ID is the transaction ID.

How `Transaction.Pending` & `Transaction.Enriched` work.
Subscribe to both [webhooks](../../../developers/using-api/webhooks.mdx) to stay updated on your transactions.

## Guides {#guides}

Expand Down
13 changes: 12 additions & 1 deletion docs/topics/payments/cards/sandbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,15 @@ Simulating receiving authorization for a card payment by entering testing data..
1. Click **Simulate**.
1. After clicking **Simulate**, notice the status change to `Success`, meaning your authorization was executed successfully.

![Screenshot of Swan Dashboard authorization release page in event simulator](../../../images/topics/payments/cards/sandbox-card-auth-release.png)
![Screenshot of Swan Dashboard authorization release page in event simulator](../../../images/topics/payments/cards/sandbox-card-auth-release.png)

## Simulate receiving enriched card transaction information {#simulate-enriched}

<mark>UPDATE WHEN AVAILABLE</mark>

1. Go to **Dashboard** > **Developers** > **Event Simulator**.
1. Go to **$SIMULATION** (not shown).
1. Go to the tab for `...` .
1. Enter the transaction ID and `...` .
1. Click **Simulate**.
1. After clicking **Simulate**, notice `...` .

0 comments on commit 0fc8383

Please sign in to comment.