private function getPaypalAttributes(Order $order) { $paypal_attrs = array('cmd' => '_xclick', 'charset' => 'utf-8', 'currency_code' => 'USD', 'bn' => 'WorkshopMultimedia_BuyNow_WPS_US', 'lc' => 'US', 'cn' => 'Please add any notes or instructions for Workshop Multimedia about your order.', 'no_shipping' => 1, 'rm' => 0, 'cbt' => 'Return to Workshop Multimedia to complete order.'); $paypal_attrs['item_name'] = 'Workshop Multimedia CD/DVD/MP3 Order #' . $order->id; $paypal_attrs['item_number'] = $order->id; $order = OrdersController::getOrderCharges($order); $paypal_attrs['amount'] = $order->subtotal_amt; $paypal_attrs['discount_amount'] = $order->discounts; $paypal_attrs['shipping'] = $order->shipping_charge; $paypal_attrs['business'] = Config::get('workshop.paypal_acct_email'); // Attributes for customer and customer address // https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HI0J0VU // https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/formbasics/#id08A6F0SJ04Y $paypal_attrs['email'] = $order->customer->email; $paypal_attrs['first_name'] = $order->customer->first_name; $paypal_attrs['last_name'] = $order->customer->last_name; // We save hash of customer e-mail in the Paypal 'custom' (hidden) // attribute. Then we can check this when user returns from // Paypal to ensure that this is same user. $email_hash = Hash::make($order->customer->email); $paypal_attrs['custom'] = $email_hash; Session::put('email_hash', $email_hash); Log::debug('OrdersController::getPaypalAttributes() - hash of email address ' . $order->customer->email . ': ' . print_r($email_hash, TRUE)); $paypal_attrs['night_phone_a'] = substr(preg_replace("/[^0-9]/", "", $order->customer->telephone1), 0, 3); $paypal_attrs['night_phone_b'] = substr(preg_replace("/[^0-9]/", "", $order->customer->telephone1), 3, 3); $paypal_attrs['night_phone_c'] = substr(preg_replace("/[^0-9]/", "", $order->customer->telephone1), 6, 4); $paypal_attrs['address1'] = $order->customer->address->addr1; $paypal_attrs['address2'] = $order->customer->address->addr2; $paypal_attrs['city'] = $order->customer->address->city; $paypal_attrs['state'] = $order->customer->address->state; $paypal_attrs['zip'] = $order->customer->address->postal_code; $paypal_attrs['country'] = substr($order->customer->address->country, 0, 2); // URLs for processing Paypal transaction $paypal_attrs['return'] = route('order-complete', array('order' => $order->id, 'hashkey' => $email_hash)); $paypal_attrs['cancel_return'] = route('order-cancel', $order->id); $paypal_attrs['notify_url'] = route('ipn'); if (Config::get('app.debug')) { $paypal_attrs['form_action_url'] = 'https://www.sandbox.paypal.com/'; } else { $paypal_attrs['form_action_url'] = 'https://www.paypal.com/'; } Log::debug('Paypal attributes for order #' . $order->id . ': ' . print_r($paypal_attrs, TRUE)); return $paypal_attrs; }