Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment