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 |
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": "[email protected]",
"customer_id": 56,
"form_id": 5,
"form_title": "UI Kit",
"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 |
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.