• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / add_refund_javascript() – Adds a "Refund in PayPal" checkbox when switching the payment’s status to "Refunded".

You appear to be a bot. Output may be restricted

Description

Adds a "Refund in PayPal" checkbox when switching the payment's status to "Refunded".

Usage

$void = add_refund_javascript( $payment_id );

Parameters

$payment_id
( int ) required –

Returns

void

Source

File name: easy-digital-downloads/includes/gateways/paypal/deprecated.php


Lines:

1 to 36 of 36
function add_refund_javascript( $payment_id ) {
  _edd_deprecated_function( __FUNCTION__, '3.0', null, debug_backtrace() );

  $payment = edd_get_payment( $payment_id );

  if ( ! $payment || 'paypal_commerce' !== $payment->gateway ) {
    return;
  }

  $mode = ( 'live' === $payment->mode ) ? API::MODE_LIVE : API::MODE_SANDBOX;

  try {
    $api = new API( $mode );
  } catch ( Exceptions\Authentication_Exception $e ) {
    // If we don't have credentials.
    return;
  }

  $label = __( 'Refund Transaction in PayPal', 'easy-digital-downloads' );
  ?>
	<script type="text/javascript">
		jQuery( document ).ready( function ( $ ) {
			$( 'select[name=edd-payment-status]' ).change( function () {
				if ( 'refunded' === $( this ).val() ) {
					$( this ).parent().parent().append( '<input type="checkbox" id="edd-paypal-commerce-refund" name="edd-paypal-commerce-refund" value="1" style="margin-top:0">' );
					$( this ).parent().parent().append( '<label for="edd-paypal-commerce-refund"><?php echo esc_html( $label ); ?></label>' );
				} else {
					$( '#edd-paypal-commerce-refund' ).remove();
					$( 'label[for="edd-paypal-commerce-refund"]' ).remove();
				}
			} );
		} );
	</script>
	<?php
}
 

 View on GitHub View on Trac

Published: 12th September 2021 | Last updated: 14th September 2022

Primary Sidebar

Information

Function name: add_refund_javascript
Plugin ref: Easy Digital Downloads
Version: 3.1.0.2
Sourcefile: includes/gateways/paypal/deprecated.php
File ref: includes/gateways/paypal/deprecated.php
Deprecated?: No
API Letters: A,J,R

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 6.2.2
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins