Products API
API reference for creating and managing products.
Manage products programmatically via the GoPayLocal API. All endpoints require a secret API key.
List Products
Section titled “List Products”GET /v1/productscurl -X GET https://api.gopaylocal.com/v1/products \ -H "Authorization: Bearer gpl_sk_live_xyz789"const res = await fetch('https://api.gopaylocal.com/v1/products', { headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789' },});const { data } = await res.json();Response:
{ "data": [ { "id": "prod_abc123", "name": "Pro Plan", "url": "https://yourapp.com/pricing", "baseCurrency": "USD", "basePrice": 9.99, "description": "Monthly pro plan", "createdAt": "2025-01-15T10:30:00Z", "updatedAt": "2025-01-15T10:30:00Z" } ]}Get Product
Section titled “Get Product”GET /v1/products/:idcurl -X GET https://api.gopaylocal.com/v1/products/prod_abc123 \ -H "Authorization: Bearer gpl_sk_live_xyz789"const res = await fetch('https://api.gopaylocal.com/v1/products/prod_abc123', { headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789' },});const { data } = await res.json();Create Product
Section titled “Create Product”POST /v1/productscurl -X POST https://api.gopaylocal.com/v1/products \ -H "Authorization: Bearer gpl_sk_live_xyz789" \ -H "Content-Type: application/json" \ -d '{ "name": "Pro Plan", "url": "https://yourapp.com/pricing", "baseCurrency": "USD", "basePrice": 9.99, "description": "Monthly pro plan" }'const res = await fetch('https://api.gopaylocal.com/v1/products', { method: 'POST', headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'Pro Plan', url: 'https://yourapp.com/pricing', baseCurrency: 'USD', basePrice: 9.99, description: 'Monthly pro plan', }),});const { data } = await res.json();Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Product name |
url | string | Yes | Product URL |
baseCurrency | string | Yes | Base currency code (e.g., “USD”) |
basePrice | number | Yes | Base price in the base currency |
description | string | No | Internal description |
Response: 201 Created
{ "data": { "id": "prod_abc123", "name": "Pro Plan", "url": "https://yourapp.com/pricing", "baseCurrency": "USD", "basePrice": 9.99, "description": "Monthly pro plan", "createdAt": "2025-01-15T10:30:00Z", "updatedAt": "2025-01-15T10:30:00Z" }}Update Product
Section titled “Update Product”PATCH /v1/products/:idcurl -X PATCH https://api.gopaylocal.com/v1/products/prod_abc123 \ -H "Authorization: Bearer gpl_sk_live_xyz789" \ -H "Content-Type: application/json" \ -d '{ "name": "Pro Plan (Updated)", "basePrice": 12.99 }'const res = await fetch('https://api.gopaylocal.com/v1/products/prod_abc123', { method: 'PATCH', headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'Pro Plan (Updated)', basePrice: 12.99, }),});All fields are optional — only include the fields you want to update.
Delete Product
Section titled “Delete Product”DELETE /v1/products/:idcurl -X DELETE https://api.gopaylocal.com/v1/products/prod_abc123 \ -H "Authorization: Bearer gpl_sk_live_xyz789"await fetch('https://api.gopaylocal.com/v1/products/prod_abc123', { method: 'DELETE', headers: { 'Authorization': 'Bearer gpl_sk_live_xyz789' },});Response: 204 No Content