<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic &amp;quot;Expected an order id to be passed&amp;quot; when integrating with paypal smart payment buttons. in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/quot-Expected-an-order-id-to-be-passed-quot-when-integrating/m-p/68226#M41472</link>
    <description>&lt;P&gt;This has to be something really simple. I am able to use fetch to make a server call to my rest api and return the response without any issues. I can receive the data.orderID, but after the thens for the fetch complete, I continually get the "Expected an order id to be passed" message. I have tried returning the transId and the token as the id and orderID, but I still get the same message. Can someone please tell me what I am doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paypal.Buttons({&lt;BR /&gt;createOrder: function () {&lt;/P&gt;&lt;P&gt;return fetch('http://localhost:22553/ewsmainservice.svc/AuthorizationOnly', {&lt;BR /&gt;method: 'post',&lt;BR /&gt;body: JSON.stringify({"foo": "bar"}),&lt;BR /&gt;headers: {'Content-Type': 'application/json'}&lt;BR /&gt;}).then(function (res) {&lt;BR /&gt;return res.json();&lt;BR /&gt;}).then(function (data) {&lt;BR /&gt;var getData = JSON.parse(data);&lt;BR /&gt;return getData.orderID;&lt;BR /&gt;});&lt;BR /&gt;},&lt;BR /&gt;// Finalize the transaction&lt;BR /&gt;onApprove: function(data, actions) {&lt;BR /&gt;return fetch('/demo/checkout/api/paypal/order/' + data.orderID + '/capture/', {&lt;BR /&gt;method: 'post'&lt;BR /&gt;}).then(function (res) {&lt;BR /&gt;return res.json();&lt;BR /&gt;}).then(function (details) {&lt;BR /&gt;// Show a success message to the buyer&lt;BR /&gt;alert('Transaction completed by ' + details.payer.name.given_name + '!');&lt;BR /&gt;});&lt;BR /&gt;},&lt;BR /&gt;onError: function(err) {&lt;BR /&gt;// Show an error page here, when an error occurs&lt;BR /&gt;//alert('in onError');&lt;BR /&gt;$('#AddShippingInfoDiv').css('display', 'block');&lt;BR /&gt;$('#AddShippingInfo').text(err.message);&lt;BR /&gt;console.log(err);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;},&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2019 01:11:42 GMT</pubDate>
    <dc:creator>ewslogin1</dc:creator>
    <dc:date>2019-07-01T01:11:42Z</dc:date>
    <item>
      <title>"Expected an order id to be passed" when integrating with paypal smart payment buttons.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/quot-Expected-an-order-id-to-be-passed-quot-when-integrating/m-p/68226#M41472</link>
      <description>&lt;P&gt;This has to be something really simple. I am able to use fetch to make a server call to my rest api and return the response without any issues. I can receive the data.orderID, but after the thens for the fetch complete, I continually get the "Expected an order id to be passed" message. I have tried returning the transId and the token as the id and orderID, but I still get the same message. Can someone please tell me what I am doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paypal.Buttons({&lt;BR /&gt;createOrder: function () {&lt;/P&gt;&lt;P&gt;return fetch('http://localhost:22553/ewsmainservice.svc/AuthorizationOnly', {&lt;BR /&gt;method: 'post',&lt;BR /&gt;body: JSON.stringify({"foo": "bar"}),&lt;BR /&gt;headers: {'Content-Type': 'application/json'}&lt;BR /&gt;}).then(function (res) {&lt;BR /&gt;return res.json();&lt;BR /&gt;}).then(function (data) {&lt;BR /&gt;var getData = JSON.parse(data);&lt;BR /&gt;return getData.orderID;&lt;BR /&gt;});&lt;BR /&gt;},&lt;BR /&gt;// Finalize the transaction&lt;BR /&gt;onApprove: function(data, actions) {&lt;BR /&gt;return fetch('/demo/checkout/api/paypal/order/' + data.orderID + '/capture/', {&lt;BR /&gt;method: 'post'&lt;BR /&gt;}).then(function (res) {&lt;BR /&gt;return res.json();&lt;BR /&gt;}).then(function (details) {&lt;BR /&gt;// Show a success message to the buyer&lt;BR /&gt;alert('Transaction completed by ' + details.payer.name.given_name + '!');&lt;BR /&gt;});&lt;BR /&gt;},&lt;BR /&gt;onError: function(err) {&lt;BR /&gt;// Show an error page here, when an error occurs&lt;BR /&gt;//alert('in onError');&lt;BR /&gt;$('#AddShippingInfoDiv').css('display', 'block');&lt;BR /&gt;$('#AddShippingInfo').text(err.message);&lt;BR /&gt;console.log(err);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;},&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 01:11:42 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/quot-Expected-an-order-id-to-be-passed-quot-when-integrating/m-p/68226#M41472</guid>
      <dc:creator>ewslogin1</dc:creator>
      <dc:date>2019-07-01T01:11:42Z</dc:date>
    </item>
  </channel>
</rss>

