WP SmartPay exposes a REST API under the /wp-json/smartpay/v1/ namespace. You can use it to read payments, customers, forms, and subscriptions from external …
WP SmartPay exposes a REST API under the /wp-json/smartpay/v1/ namespace. You can use it to read payments, customers, forms, and subscriptions from external applications — dashboards, mobile apps, or custom integrations.
Authentication
All API requests require authentication. Use WordPress Application Passwords (WordPress 5.6+):
- Go to WordPress Admin → Users → Profile → Application Passwords.
- Enter a name for the password (e.g., "My App") and click Add New Application Password.
- Copy the generated password — it won't be shown again.
- Authenticate using HTTP Basic Auth:
Authorization: Basic base64(username:password).
For server-side integrations, you can also use a WordPress nonce (X-WP-Nonce) when making requests from within WordPress (e.g., from JavaScript in the admin).
Endpoints
Payments
| Method | Endpoint | Description |
GET |
/wp-json/smartpay/v1/payments |
List payments. Supports: ?status=completed, ?page=1, ?per_page=20, ?from=2026-01-01, ?to=2026-07-28, ?donation=1 (gifts only) or ?donation=0 (sales only; omit for both) |
GET |
/wp-json/smartpay/v1/payments/{id} |
Get a single payment by ID |
Payment Response Fields
{
"id": 1234,
"key": "sp_abc123",
"amount": 4900,
"currency": "USD",
"status": "completed",
"gateway": "stripe",
"mode": "live",
"email": "jane@example.com",
"customer_id": 56,
"form_id": 5,
"form_title": "UI Kit",
"campaign_title": "Spring Appeal",
"created_at": "2026-07-28T10:23:00Z",
"updated_at": "2026-07-28T10:23:05Z"
}
Customers
| Method | Endpoint | Description |
GET |
/wp-json/smartpay/v1/customers |
List customers |
GET |
/wp-json/smartpay/v1/customers/{id} |
Get a single customer |
Subscriptions (Pro)
| Method | Endpoint | Description |
GET |
/wp-json/smartpay-pro/v1/subscriptions |
List subscriptions |
GET |
/wp-json/smartpay-pro/v1/subscriptions/{id} |
Get a single subscription |
Campaigns
Admin only.
| Method | Endpoint | Description |
GET / POST | /wp-json/smartpay/v1/campaigns | List (page, per_page, search, status) / create |
GET / PUT / DELETE | /wp-json/smartpay/v1/campaigns/{id} | Get / update / delete |
GET | /wp-json/smartpay/v1/campaigns/{id}/overview | Stats (range=today|7d|30d|all) |
GET / POST | /wp-json/smartpay/v1/campaigns/{id}/forms | List / attach (form_ids[]) |
DELETE | /wp-json/smartpay/v1/campaigns/{id}/forms/{form_id} | Detach a form |
POST | /wp-json/smartpay/v1/campaigns/{id}/default-form | Set the default form (form_id) |
GET | /wp-json/smartpay/v1/campaigns/{id}/donors | Campaign donors (type, flag, search) |
Donors
| Method | Endpoint | Description |
GET | /wp-json/smartpay/v1/donors | List (type, search, campaign, orderby=latest|total|gifts|name|oldest) |
GET | /wp-json/smartpay/v1/donors/{id} | Single donor with giving history |
Donations (Pro)
| Method | Endpoint | Description |
GET | /wp-json/smartpay-pro/v1/campaigns/{id}/wall | Public donor wall (view=recent|top, page); 404 if the list is private |
GET | /wp-json/smartpay-pro/v1/reports/campaigns | Campaign report (period, start, end, campaign) |
GET | /wp-json/smartpay-pro/v1/export/donors, /export/customers | CSV export |
GET / POST / DELETE | /wp-json/smartpay-pro/v1/donors/{id}/notes[/{note}] | Private donor notes |
POST | /wp-json/smartpay-pro/v1/donations/{id}/approve | Approve a held comment |
POST | /wp-json/smartpay-pro/v1/campaigns/{id}/donors/{customer_id}/wall | Show or hide a donor on the wall |
GET | /wp-json/smartpay-pro/v1/subscriptions?donation=0|1 | Filter subscriptions by type |
Forms
| Method | Endpoint | Description |
GET |
/wp-json/smartpay/v1/forms |
List payment forms |
GET |
/wp-json/smartpay/v1/forms/{id} |
Get a single form |
Example Requests
List completed payments (curl)
curl -X GET \
"https://yoursite.com/wp-json/smartpay/v1/payments?status=completed&per_page=50" \
-H "Authorization: Basic $(echo -n 'admin:xxxx xxxx xxxx xxxx xxxx xxxx' | base64)"
Get a payment by ID (JavaScript fetch)
const response = await fetch(
'https://yoursite.com/wp-json/smartpay/v1/payments/1234',
{
headers: {
'X-WP-Nonce': wpApiSettings.nonce,
},
}
);
const payment = await response.json();
Extending the REST API
You can register custom endpoints under the SmartPay namespace from your plugin:
add_action( 'rest_api_init', function() {
register_rest_route( 'smartpay/v1', '/custom-report', [
'methods' => WP_REST_Server::READABLE,
'callback' => 'my_custom_report_handler',
'permission_callback' => function() {
return current_user_can( 'manage_options' );
},
]);
});
function my_custom_report_handler( WP_REST_Request $request ) {
// Your custom report logic
return rest_ensure_response( [ 'total' => 1234 ] );
}
Notes
- Amounts are returned in the smallest currency unit — for USD, $49.00 is returned as
4900 (cents). Always divide by 100 for USD, EUR, GBP; some currencies (JPY) have no minor unit.
- The API requires an active SmartPay Pro license for Pro endpoints (
smartpay-pro/v1/).
- All list endpoints support pagination via
?page=N&per_page=N. Default page size is 20.
- Date filtering uses ISO 8601 format:
?from=2026-01-01T00:00:00&to=2026-07-28T23:59:59.