: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'payment' => $this->payment,
'gateway_name' => $this->get_gateway_name(),
'gateway_link' => $this->get_gateway_dashboard_link(),
'form_edit_link' => ! empty( $form_edit_link ) ? $form_edit_link : Helpers::get_placeholder_na_text(),
'test_mode' => $this->payment->mode === 'test',
'delete_link' => wp_nonce_url(
'page' => 'wpforms-payments',
'payment_id' => $this->payment->id,
'bulk-wpforms_page_wpforms-payments'
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'admin/payments/single/log',
'logs' => wpforms()->get( 'payment_meta' )->get_all_by( 'log', $this->payment->id ),
// TODO: Remove hardcoded values in methods below after all payment addons updated to use new filters.
* Get gateway transaction link.
private function get_gateway_transaction_link() { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
* Allow to modify a single payment page gateway transaction link.
* @param string $link Gateway transaction link.
* @param object $payment Payment object.
$link = apply_filters( 'wpforms_admin_payments_views_single_gateway_transaction_link', '', $this->payment );
if ( ! $this->payment->transaction_id ) {
switch ( $this->payment->gateway ) {
$link = 'activity/payment/';
$link = 'sales/transactions/';
return $this->get_gateway_dashboard_link();
return $this->get_gateway_dashboard_link() . $link . $this->payment->transaction_id;
* Get gateway subscription link.
private function get_gateway_subscription_link() {
* Allow to modify a single payment page gateway subscription link.
* @param string $link Gateway subscription link.
* @param object $payment Payment object.
$link = apply_filters( 'wpforms_admin_payments_views_single_gateway_subscription_link', '', $this->payment );
switch ( $this->payment->gateway ) {
$link = 'subscriptions/';
$link = 'billing/subscriptions/';
return $this->get_gateway_dashboard_link();
return $this->get_gateway_dashboard_link() . $link . $this->payment->subscription_id;
* Get gateway customer link.
private function get_gateway_customer_link() {
* Allow to modify a single payment page gateway customer link.
* @param string $link Gateway customer link.
* @param object $payment Payment object.
$link = apply_filters( 'wpforms_admin_payments_views_single_gateway_customer_link', '', $this->payment );
switch ( $this->payment->gateway ) {
$link = 'customers/directory/customer/';
return $this->get_gateway_dashboard_link();
return $this->get_gateway_dashboard_link() . $link . $this->payment->customer_id;
* Get gateway dashboard link.
private function get_gateway_dashboard_link() { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.MaxExceeded, Generic.Metrics.CyclomaticComplexity.TooHigh
* Allow to modify a single payment page gateway dashboard link.
* @param string $link Gateway dashboard link.
* @param object $payment Payment object.
$link = apply_filters( 'wpforms_admin_payments_views_single_gateway_dashboard_link', '', $this->payment );
$is_test_mode = $this->payment->mode === 'test';
// Backward compatibility until all addons has been updated.
switch ( $this->payment->gateway ) {
$link = $is_test_mode ? 'https://dashboard.stripe.com/test/' : 'https://dashboard.stripe.com/';
$link = $is_test_mode ? 'https://www.sandbox.paypal.com/myaccount/summary/' : 'https://www.paypal.com/myaccount/summary/';
$link = $is_test_mode ? 'https://sandbox.authorize.net/' : 'https://account.authorize.net/';
$link = $is_test_mode ? 'https://squareupsandbox.com/dashboard/' : 'https://squareup.com/t/cmtp_performance/pr_developers/d_partnerships/p_WPForms/?route=dashboard/';
* Get gateway action link.
* @param string $action Action.
private function get_gateway_action_link( $action ) {
* Allow to modify a single payment page gateway action link.
* @param string $link Gateway action link.
* @param string $action Action to perform.
* @param object $payment Payment object.
$link = apply_filters( 'wpforms_admin_payments_views_single_gateway_action_link', '', $action, $this->payment );
// Backward compatibility until all addons has been updated.
if ( $action === 'refund' ) {
return $this->get_gateway_transaction_link();
return $this->get_gateway_subscription_link();
* Retrieve a readable payment gateway name.
private function get_gateway_name() {
$gateway_name = Helpers::get_placeholder_na_text( false );
if ( isset( $this->payment->gateway ) && ValueValidator::is_valid( $this->payment->gateway, 'gateway' ) ) {
$gateway_name = ValueValidator::get_allowed_gateways()[ $this->payment->gateway ];
* Retrieve a readable payment status label.
private function get_status_label() {
$label = ValueValidator::get_allowed_one_time_statuses()[ $this->payment->status ];
if ( $this->payment->status !== 'partrefund' ) {
$refunded_amount = isset( $this->payment_meta['refunded_amount']->value ) ? wpforms_sanitize_amount( $this->payment_meta['refunded_amount']->value, $this->payment->currency ) : 0;
$label .= wpforms_format_amount( $refunded_amount, true, $this->payment->currency );
* If the form is still available, return a link to edit it.
* Otherwise, return an empty string.
private function get_form_edit_link() {
// Leave early if no form ID is found.
if ( ! $this->payment->form_id ) {
$form = wpforms()->get( 'form' )->get( $this->payment->form_id );
// Leave early if form is no longer available.
if ( ! $form || $form->post_status !== 'publish' ) {
$name = ! empty( $form->post_title ) ? $form->post_title : $form->post_name;
'page' => 'wpforms-builder',
'form_id' => $this->payment->form_id,
return sprintf( '<a href="%1$s" class="wpforms-link">%2$s</a>', esc_url( $url ), wp_kses_post( $name ) );