- Merchant onboarding — registering and connecting seller accounts as Partners
- Payment gateway — processing end-customer payments, creating orders, and managing webhooks
Configuration
Two clients
Merchant onboarding
1. Create Partner Referral
- Flow: User → Core Backend → Integration Services → PayPal API
- Internal endpoint:
POST /paypal/partner-referrals - PayPal endpoint:
POST /v2/customer/partner-referrals
onboarding_url to redirect the seller to.
2. Onboarding return (callback)
- Flow: PayPal → User redirect → Core Backend
- The Core Backend receives
merchantIdandtrackingIdin the URL and persists themerchantId.
This step does not call the Integration Service.
3. Verify merchant integration
- Internal endpoint:
GET /paypal/merchant-integrations/:merchantId
payments_receivable === true and vetting_status !== 'DENIED', the Core Backend
enables the PayPal gateway for that shop.
Payment & checkout
Create payment intent
- Internal endpoint:
POST /payment-gateway/create-intent
Webhook handling & normalization
- Flow: PayPal → Integration Services → Core Backend (
/webhook/generic)
Status mapping
Flow diagrams
Merchant onboarding
Payment checkout
Security notes
1
Webhook verification
All webhooks are validated using
paypal-transmission-sig and PAYPAL_WEBHOOK_ID. The
signature includes transmissionId, timestamp, webhookId, and the CRC32 of the
request body.2
Token management
A new access token is obtained for each onboarding request (Client Credentials Flow).
No sensitive tokens are logged.
3
HMAC comparison
crypto.timingSafeEqual (or safeCompareHmac) is used to compare signatures and
prevent timing attacks.