Campaigns API
API reference for creating and managing campaigns.
Manage campaigns programmatically. Campaigns link products to discount rules and banner configuration.
List Campaigns
Section titled “List Campaigns”GET /v1/campaignscurl -X GET https://api.gopaylocal.com/v1/campaigns \ -H "Authorization: Bearer gpl_sk_live_xyz789"const res = await fetch('https://api.gopaylocal.com/v1/campaigns', { headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789' },});const { data } = await res.json();Query Parameters:
| Parameter | Type | Description |
|---|---|---|
productId | string | Filter by product ID |
status | string | Filter by status: active, paused, draft |
Get Campaign
Section titled “Get Campaign”GET /v1/campaigns/:idCreate Campaign
Section titled “Create Campaign”POST /v1/campaignscurl -X POST https://api.gopaylocal.com/v1/campaigns \ -H "Authorization: Bearer gpl_sk_live_xyz789" \ -H "Content-Type: application/json" \ -d '{ "productId": "prod_abc123", "name": "Pro Plan PPP", "pricingMode": "group", "discountDelivery": "banner_coupon", "maxDiscount": 60, "couponPrefix": "PPP", "allowedDomains": ["yourapp.com", "www.yourapp.com"], "charmPricing": { "enabled": true, "strategy": "currency_aware" }, "banner": { "position": "bottom-right", "messageTemplate": "Hey! We support PPP for {{countryName}}. Use code {{code}} for {{discount}} off.", "ctaText": "Copy Code", "backgroundColor": "#1a1a2e", "textColor": "#ffffff", "ctaColor": "#e94560", "ctaTextColor": "#ffffff", "showFlag": true, "showCloseBtn": true } }'const res = await fetch('https://api.gopaylocal.com/v1/campaigns', { method: 'POST', headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789', 'Content-Type': 'application/json', }, body: JSON.stringify({ productId: 'prod_abc123', name: 'Pro Plan PPP', pricingMode: 'group', discountDelivery: 'banner_coupon', maxDiscount: 60, couponPrefix: 'PPP', allowedDomains: ['yourapp.com', 'www.yourapp.com'], charmPricing: { enabled: true, strategy: 'currency_aware', }, banner: { position: 'bottom-right', messageTemplate: 'Hey! We support PPP for {{countryName}}. Use code {{code}} for {{discount}} off.', ctaText: 'Copy Code', backgroundColor: '#1a1a2e', textColor: '#ffffff', ctaColor: '#e94560', ctaTextColor: '#ffffff', showFlag: true, showCloseBtn: true, }, }),});Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
productId | string | Yes | Associated product ID |
name | string | Yes | Campaign name |
pricingMode | string | Yes | "group", "ppp_factor", or "custom" |
discountDelivery | string | Yes | "banner_coupon" or "auto_apply" |
maxDiscount | number | No | Maximum discount percentage (0-100) |
couponPrefix | string | No | Prefix for coupon codes (default: “PPP”) |
allowedDomains | string[] | No | Domains where the banner can appear |
charmPricing | object | No | Charm pricing configuration |
charmPricing.enabled | boolean | No | Enable charm pricing |
charmPricing.strategy | string | No | Charm pricing strategy |
banner | object | No | Banner display configuration |
banner.position | string | No | Banner position |
banner.messageTemplate | string | No | Message with placeholders |
banner.ctaText | string | No | CTA button text |
banner.backgroundColor | string | No | Background color |
banner.textColor | string | No | Text color |
banner.ctaColor | string | No | CTA button color |
banner.ctaTextColor | string | No | CTA button text color |
banner.showFlag | boolean | No | Show country flag |
banner.showCloseBtn | boolean | No | Show close button |
Update Campaign
Section titled “Update Campaign”PATCH /v1/campaigns/:idAll fields are optional. Only include the fields you want to update.
Delete Campaign
Section titled “Delete Campaign”DELETE /v1/campaigns/:idResponse: 204 No Content
Activate / Pause Campaign
Section titled “Activate / Pause Campaign”POST /v1/campaigns/:id/activatePOST /v1/campaigns/:id/pauseToggle a campaign between active and paused states.