Endpoint #
PUT /wp-json/rtcl/v1/subscription/update-pm
Description #
Updates the saved payment method for a user’s active subscription.
The required fields depend on the subscription’s payment gateway.
Authentication & Permission #
This endpoint requires: #
- REST API enabled in RTCL settings
- Valid authentication headers
- API Key
- Bearer JWT Token
- User must be:
- Logged in
Required Headers #
| Header | Required | Description |
|---|---|---|
Content-Type | ✅ | application/json |
X-API-KEY | ✅ | REST API key |
Authorization | ✅ | Bearer <access_token> |
Request Parameters #
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | ✅ | Subscription ID |
Stripe / Stripe CC Gateway #
| Field | Type | Required | Description |
|---|---|---|---|
stripe_pm_id | string | ✅ | Stripe Payment Method ID (must start with pm_) |
Authorize.Net Gateway #
| Field | Type | Required | Description |
|---|---|---|---|
card_number | string | ✅ | Credit card number (no spaces) |
card_expiry | string | ✅ | Expiry date (MM/YYYY or MM-YYYY) |
card_cvc | integer | ✅ | Card CVC |
cURL Examples #
Stripe – Update Payment Method #
curl -X POST "https://example.com/wp-json/rtcl/v1/subscription/update-pm" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"id": 12,
"stripe_pm_id": "pm_1QabcXYZ123456"
}'
Authorize.Net – Update Card #
curl -X POST "https://example.com/wp-json/rtcl/v1/subscription/update-pm" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"id": 12,
"card_number": "4111111111111111",
"card_expiry": "12/2027",
"card_cvc": 123
}'
Success Responses #
Stripe Success Response #
{
"payment_method": "pm_1QabcXYZ123456",
"message": "Subscription payment card information updated."
}
Authorize.Net Success Response #
{
"type": "visa",
"last4": "1111",
"expiry": "2027-12",
"message": "Subscription payment card information updated."
}
Error Responses #
Not Logged In #
{
"code": "rtcl_rest_authentication_error",
"message": "You are not logged in.",
"data": {
"status": 404
}
}
Subscription Not Found #
{
"code": "rtcl_rest_authentication_error",
"message": "Subscription not found.",
"data": {
"status": 400
}
}
Missing Stripe Payment Method ID #
{
"code": "rtcl_rest_authentication_error",
"message": "No payment method id found.",
"data": {
"status": 400
}
}
Invalid Stripe Payment Method ID #
{
"code": "rtcl_rest_authentication_error",
"message": "Invalid payment method id.",
"data": {
"status": 400
}
}
Missing Card Fields (Authorize.Net) #
{
"code": "rtcl_rest_authentication_error",
"message": "Please select card field",
"data": {
"status": 400
}
}
Unsupported Card Type #
{
"code": "rtcl_rest_authentication_error",
"message": "Merchant do not support accepting in American Express",
"data": {
"status": 400
}
}
Gateway Update Failed #
{
"code": "rtcl_rest_authentication_error",
"message": "Unable to update subscription payment method.",
"data": {
"status": 400
}
}
Subscription Gateway Not Found #
{
"code": "rtcl_rest_authentication_error",
"message": "Subscription gateway not found.",
"data": {
"status": 400
}
}