0

Study case : customers already have the ability to pay only a deposit. So they 'll have to come back and pay the order balance later.

How can I create a payment form ?

  • where they will be able to directly submit a payment form and proceed to off-site payment to pay order balance
  • without coming from cart/checkout process, (as it has already be done in deposit payment another day)

This will be linked from the user/%/orders/% page.

Is there any commerce API function that could fit that issue ? I had a look at commerce_payment_order_transaction_add_form($form, &$form_state, $order but I could not find any doc to implement it, .

Thank you

PS : related issue: Commerce partial payment

0

I got it doing the following :

with a link in user/%/orders/% page like go_to_checkout/$order_id

/**
 * Implements hook_menu();
 * Callback to pass order_id to checkout fn
 */
function commerce_partial_payment_menu() {

  $items['go_to_checkout'] = array(
    'title' => 'balance',
    'description' => 'Pay order balance',
    'page callback' => 'commerce_partial_payment_redirect_to_checkout',
    'page arguments' => array(1),
    'access arguments' =>  TRUE,//still have to change that, maybe see own orders permission
    'type' => MENU_CALLBACK,
  );

  return $items;
}

/*
 * Prepare checkout process and redirects to checkout/%/review 
 */
function commerce_partial_payment_redirect_to_checkout($order_id) {

  $order = commerce_order_load($order_id);
  commerce_order_status_update($order, 'checkout_review', $skip_save = FALSE, $revision = TRUE, $log = '');

  drupal_goto('checkout/' . $order->order_id. '/review');
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.