autoship_get_general_payment_method_data()

(src/payments.php) Takes two arguments, a WooCommerce token id, and a payment gateway id. The function returns the an array containing the Autoship payment data used to create Scheduled Orders via the QPilot API.

Function:

/**
 * Returns the payment method data.
 * @param int|WC_Customer $wc_customer The WC Customer ID or Object.
 * @param array $data Optional. Customer Data to use as an override.
 * @return array The Customer Data
 */
function autoship_get_general_payment_method_data( $token_id, $gateway ){

  // Get the Type of Gateway ( standard tokenized or non-standard )
  $gateway_type= autoship_get_payment_method_gateway_type( $gateway );

  // Retrieve the token and run it through our filter so that non-standard gateway
  // Payment methods can be retrieved.
  $token       = apply_filters( 'autoship_payment_method_tokenization', WC_Payment_Tokens::get( $token_id ),$token_id, $gateway_type );
  $type        = autoship_get_valid_payment_method_type( $token->get_gateway_id() );

  return !is_null( $token ) ?
  autoship_add_general_payment_method( $token, true ) : array();

}