---
title: "rcp_recurring_payment_failed"
source: "https://docs.nexcess.com/software/kadence/restrict-content-pro/rcp_recurring_payment_failed/"
description: "Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experien…"
vertical: "Software"
area: "Restrict Content Pro"
date: "2023-04-20"
last_modified: "2026-08-12"
---

# rcp_recurring_payment_failed

**Coming soon:** Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.

Note: This is part of the developer docs and is considered custom code. Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code. If you need assistance with this, please reach out to our list of consultants for further assistance: https://codeable.io/developers/restrict-content-pro/ Triggers when an automatic renewal payment fails at the payment gateway. Parameters: $member (RCP\_Member) – RCP\_Member object, which extends the WP\_User object. $gateway (RCP\_Payment\_Gateway) – Payment gateway object. Example: Adds a note to the membership record when a recurring payment fails. /\*\* \* Add a note to the member when a recurring charge fails. \* \* @param RCP\_Member $member \* @param RCP\_Payment\_Gateway $gateway \* \* @return void \*/ function rcp\_add\_recurring\_payment\_failure\_note( $member, $gateway ) { $membership = $gateway->membership; $gateway\_classes = wp\_list\_pluck( rcp\_get\_payment\_gateways(), ‘class’ ); $gateway\_name = array\_search( get\_class( $gateway ), $gateway\_classes ); $note = sprintf( \_\_( ‘Recurring charge failed in %s.’, ‘rcp’ ), ucwords( $gateway\_name ) ); if ( ! empty( $gateway->webhook\_event\_id ) ) { $note .= sprintf( \_\_( ‘ Event ID: %s’, ‘rcp’ ), $gateway->webhook\_event\_id ); } $membership->add\_note( $note ); rcp\_log( sprintf( ‘Recurring payment failed for membership #%d. Gateway: %s; Membership Level: %s; Expiration Date: %s’, $membership->get\_id(), ucwords( $gateway\_name ), $member->get\_subscription\_name(), $membership->get\_expiration\_date() ) ); } add\_action( ‘rcp\_recurring\_payment\_failed’, ‘rcp\_add\_recurring\_payment\_failure\_note’, 10, 2 );
