0

I need help. I used this as a guide. When my user fills out and pays for something on my site using a product form the information they supplied in the form (other than their payment) is not being sent to PayPal. So I built this module to send the information using the module I'm supposed to hook into. However, it throws no errors but still sends no data to PayPal.

    if ($payment_method['base'] == 'commerce_paypal_wpp') { 

    $order_wrapper = entity_metadata_wrapper('commerce_order', 
$order);
    $shipping_info = $order_wrapper->customer_profile_billing-
>commerce_customer_address->value();

             $nvp += array(
                    'ORGANIZATION' => $shipping_info['field_organization'],
            'NAME' => $shipping_info['field_name'],
         );
    }
}

Am I perhaps referencing my user-entered data incorrectly?

Here's how the fields show with dpm($form) [before the user submits the form]:

Name:

$form['customer_profile_billing']
['commerce_customer_address']['und'][0]'name_block']['name_line']

Organization:

$form['customer_profile_billing']['field_organization']

1 Answer 1

1

From your above code i have seen that dpm($form) showing 2 fields. when you submit your data in form please ensure that your order is created or not. Becuase in your code you are getting customer order details and pass it to the array() (which is empty). Thats why it not going to Paypal website. Please check your custom code.

hook_commerce_paypal_api_request_alter(&$nvp, $order, $payment_method): What this function will do, it will alter the array before pass this data to paypal website. So you must ensure that array data you are passing to paypal is not empty or you can check the condition for it.

1
  • Interesting. I see what you mean. But let me add: the payment is going through to PayPal just fine (so it's getting the credit card data the user is filling out) - just not the rest of their information. Do you still think it's the array not getting the information?
    – Sage
    Commented Apr 25, 2016 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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