Restrict Content Pro

rcp_create_payment

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 content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro

Fires in RCP_Payments::insert() after a new payment row is successfully inserted into the database.

Use it for notifications or side effects when a payment record is created (including pending/manual payments). This is not the same as payment completion—pair with payment status hooks when you only want completed payments.

Parameters

$payment_id (int) – ID of the newly created payment.

$args (array) – Arguments used when creating the payment. Common keys:

  • subscription (string) – Membership level name.
  • object_id (int) – Related object ID (usually membership level ID).
  • object_type (string) – Usually subscription.
  • date (string) – MySQL datetime.
  • amount (float) – Final amount.
  • subtotal (float) – Base price before discounts/credits/fees.
  • credits (float) – Proration credits.
  • fees (float) – Fees.
  • discount_amount (float) – Discount amount applied.
  • discount_code (string) – Discount code used, if any.
  • user_id (int) – Associated user ID.
  • payment_type (string) – Payment type label.
  • transaction_type (string) – new, renewal, upgrade, or downgrade.
  • subscription_key (string) – Subscription key.
  • transaction_id (string) – Gateway transaction ID.
  • status (string) – e.g. complete, pending.
  • gateway (string) – Gateway slug (e.g. manual, stripe).

Examples

function mytheme_rcp_create_payment( $payment_id, $args ) {
	if ( empty( $args['gateway'] ) || 'manual' !== $args['gateway'] ) {
		return;
	}

	$user_info = get_userdata( $args['user_id'] );
	if ( ! $user_info ) {
		return;
	}

	$subject = __( 'Your payment is pending', 'mytheme' );
	$message = __( 'Hello %name%, your payment for %subscription_name% is still pending.', 'mytheme' );

	$emails              = new RCP_Emails();
	$emails->member_id   = $args['user_id'];
	$emails->payment_id  = $payment_id;
	$emails->send( $user_info->user_email, $subject, $message );
}
add_action( 'rcp_create_payment', 'mytheme_rcp_create_payment', 10, 2 );

Related: rcp_insert_payment, RCP_Payments, Using The Payment Meta API.

Last updated: November 13, 2026
Was this page helpful?
Thanks for the feedback!