For the complete documentation index, see llms.txt. This page is also available as Markdown.
Export Payments Data To Redshift for Analytics
Export your payments data to Amazon Redshift for advanced analytics and business intelligence reporting
Exporting your payments data to Amazon Redshift enhances analytics by leveraging Redshift's high-performance query capabilities. This allows for efficient data analysis, reporting, and business intelligence, thereby deriving valuable insights.
Architecture
Integration steps
Prerequisite: You need to have an AWS account with Redshift enabled. More details can be found here https://aws.amazon.com/redshift/
You are required to create a new IAM role for Redshift use and provide Juspay Hyperswitch with the corresponding role ARN. This IAM role must be configured with S3 read permissions.
Example image of an IAM role created
After sharing the ARN with Juspay Hyperswitch, we will share the S3 bucket & path that is to be synced for data along with providing access to the IAM role from where you will be able to get files from the S3.
The above query creates a temporary table to load all the CSV data and then merges this with the main table while deduplicating based on payment_id.
Self-Setup Guide for AWS
If you want to set up payment data export at your end using AWS infrastructure, you can implement your own data pipeline. This approach gives you full control over the data export process and allows customization based on your specific requirements.
Architecture Overview
The self-setup approach involves three main components:
Lambda Function/Server: Queries payment data for the past 7 days from your Juspay Hyperswitch database
Scheduled Execution: A cron job or EventBridge rule that invokes the Lambda with merchant-specific parameters
S3 Storage: Stores the exported data with proper IAM role-based access control
Step 1: Create S3 Bucket and Configure Access
First, set up the S3 bucket where payment data will be stored:
Step 2: Create Lambda Function for Data Export
Create a Lambda function that handles the data export logic:
Function Requirements:
Query payment data from your Juspay Hyperswitch database for the past 7 days
Filter data based on merchant_id parameter received from the event
Generate CSV files with the same schema as mentioned in the table creation section
Upload the CSV files to S3 with the path format: s3://bucket/merchant_id/v1/payments/date.csv
Handle database connections, error handling, and logging
# Create separate rules for each merchant
aws events put-rule \
--name payment-export-merchant-123 \
--schedule-expression "rate(6 hours)" \
--description "Export for merchant 123"
aws events put-targets \
--rule payment-export-merchant-123 \
--targets "Id"="1","Arn"="arn:aws:lambda:us-east-1:YOUR-ACCOUNT-ID:function:payment-export-lambda","Input"='{"merchant_id":"merchant_123"}'
# Or use a single rule with different inputs
aws events put-targets \
--rule payment-export-schedule \
--targets file://merchant-targets.json