Commit b2b7322d authored by Tom Ashe's avatar Tom Ashe Committed by Jonathan Sacksick
Browse files

Issue #3200525 by TomTech: Paypal Response "Expected an Order ID to be passed".

parent 267e5ceb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -502,7 +502,8 @@ function commerce_paypal_checkout_create_order($order, $payment_method) {
    $request_body = commerce_paypal_checkout_prepare_order_request($order, $payment_method['settings']);
    drupal_alter('commerce_paypal_checkout_create_order_request', $request_body, $order);
    $json = $api_client->createOrder($request_body);
    drupal_json_output(array('id' => $json['id']));
    drupal_add_http_header('Content-Type', 'text/plain');
    echo isset($json['id']) ? $json['id'] : '';
    drupal_exit();
  }
  catch (\Exception $exception) {
+4 −3
Original line number Diff line number Diff line
@@ -18,9 +18,10 @@
      $('.paypal-buttons-container').once('rendered').each(function() {
        paypal.Buttons({
          createOrder: function() {
            return Drupal.paypalCheckout.makeCall(settings.createOrderUri).then(function(data) {
              return data.id;
            });
            var ajaxSettings = {
              dataType: 'text',
            };
            return Drupal.paypalCheckout.makeCall(settings.createOrderUri, ajaxSettings);
          },
          onApprove: function (data) {
            Drupal.paypalCheckout.addLoader();