Stripe-style payments platform database schema

How a payment processor models its data: merchant accounts, tokenised payment methods, the payment intent state machine, charges and partial refunds, chargebacks with evidence deadlines, payouts, webhook deliveries and idempotency keys.

Stripe Payments ER diagram

Stripe-style payments platform database schema n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 merchants idBIGINT account_referenceVARCHAR display_nameVARCHAR country_codeCHAR default_currencyCHAR charges_enabledBOOLEAN payouts_enabledBOOLEAN payout_scheduleVARCHAR payout_delay_daysSMALLINT created_atTIMESTAMPTZ customers idBIGINT merchant_idBIGINT customer_referenceVARCHAR emailVARCHAR nameVARCHAR default_payment_m…BIGINT livemodeBOOLEAN metadataJSONB created_atTIMESTAMPTZ deleted_atTIMESTAMPTZ payment_methods idBIGINT merchant_idBIGINT customer_idBIGINT method_typeVARCHAR brandVARCHAR last_fourCHAR exp_monthSMALLINT exp_yearSMALLINT fingerprintVARCHAR processor_tokenVARCHAR billing_postal_co…VARCHAR statusVARCHAR created_atTIMESTAMPTZ payment_intents idBIGINT merchant_idBIGINT customer_idBIGINT payment_method_idBIGINT intent_referenceVARCHAR amount_minorBIGINT amount_received_m…BIGINT currency_codeCHAR statusVARCHAR capture_methodVARCHAR confirmation_meth…VARCHAR next_actionVARCHAR last_error_codeVARCHAR cancellation_reas…VARCHAR statement_descrip…VARCHAR metadataJSONB created_atTIMESTAMPTZ canceled_atTIMESTAMPTZ charges idBIGINT payment_intent_idBIGINT merchant_idBIGINT payment_method_idBIGINT charge_referenceVARCHAR amount_minorBIGINT amount_captured_m…BIGINT amount_refunded_m…BIGINT currency_codeCHAR statusVARCHAR capturedBOOLEAN failure_codeVARCHAR failure_messageVARCHAR network_transacti…VARCHAR risk_scoreSMALLINT authorization_exp…TIMESTAMPTZ created_atTIMESTAMPTZ captured_atTIMESTAMPTZ refunds idBIGINT charge_idBIGINT merchant_idBIGINT refund_referenceVARCHAR amount_minorBIGINT currency_codeCHAR reasonVARCHAR statusVARCHAR failure_reasonVARCHAR created_atTIMESTAMPTZ disputes idBIGINT charge_idBIGINT merchant_idBIGINT dispute_referenceVARCHAR amount_minorBIGINT currency_codeCHAR reasonVARCHAR statusVARCHAR evidence_due_byTIMESTAMPTZ evidence_submitte…TIMESTAMPTZ evidenceJSONB is_charge_refunda…BOOLEAN opened_atTIMESTAMPTZ resolved_atTIMESTAMPTZ balance_transactions idBIGINT merchant_idBIGINT source_typeVARCHAR charge_idBIGINT refund_idBIGINT dispute_idBIGINT payout_idBIGINT gross_minorBIGINT fee_minorBIGINT net_minorBIGINT currency_codeCHAR statusVARCHAR available_onDATE created_atTIMESTAMPTZ payouts idBIGINT merchant_idBIGINT payout_referenceVARCHAR amount_minorBIGINT currency_codeCHAR statusVARCHAR methodVARCHAR destination_last_…CHAR arrival_dateDATE failure_codeVARCHAR initiated_atTIMESTAMPTZ paid_atTIMESTAMPTZ webhook_endpoints idBIGINT merchant_idBIGINT urlVARCHAR signing_secretVARCHAR enabled_eventsJSONB statusVARCHAR api_versionVARCHAR consecutive_failu…INTEGER created_atTIMESTAMPTZ disabled_atTIMESTAMPTZ webhook_events idBIGINT merchant_idBIGINT event_referenceVARCHAR event_typeVARCHAR api_versionVARCHAR object_typeVARCHAR object_idVARCHAR payloadJSONB livemodeBOOLEAN occurred_atTIMESTAMPTZ created_atTIMESTAMPTZ webhook_deliveries idBIGINT event_idBIGINT endpoint_idBIGINT attempt_numberSMALLINT statusVARCHAR response_statusSMALLINT response_bodyTEXT duration_msINTEGER error_messageVARCHAR next_attempt_atTIMESTAMPTZ attempted_atTIMESTAMPTZ idempotency_keys idBIGINT merchant_idBIGINT idempotency_keyVARCHAR request_methodVARCHAR request_pathVARCHAR request_fingerpri…CHAR statusVARCHAR response_statusSMALLINT response_bodyJSONB resource_typeVARCHAR resource_idVARCHAR locked_atTIMESTAMPTZ created_atTIMESTAMPTZ expires_atTIMESTAMPTZ

Related database schemas