title: How to Create/Update a session? (MasterCard Gateway to integrate in android and iOS)
body: <p>I'm trying to update a session with card info.</p>
  
  <p>I'm following this guide:</p>
  
  <p><a href="https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/51/operation/Session%3a%20Update%20Session.html?locale=en_US" rel="nofollow noreferrer">https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/51/operation/Session%3a%20Update%20Session.html?locale=en_US</a></p>
  
  <p>In the section "Update session", it says:</p>
  
  <blockquote>
    <p>You can request to add or update request fields contained in the session.</p>
  </blockquote>
  
  <hr>
  
  <p>Using Postman, i set the </p>
  
  <p>Authorization: Basic Auth as 'merchant.{your gateway merchant ID}' in the username portion and your API password in the password portion.</p>
  
  <p>Url:"<strong><a href="https://ap-gateway.mastercard.com/api/rest/version/51/merchant/" rel="nofollow noreferrer">https://ap-gateway.mastercard.com/api/rest/version/51/merchant/</a>{merchantId}/session/{sessionId}</strong>"</p>
  
  <p>Method: <strong>PUT</strong></p>
  
  <p>Body: "<strong>raw</strong>" as JSON, like so:</p>
  
  <pre><code>{
      "sourceOfFunds":{
          "provided":{
              "card":{
                  "nameOnCard":"Joseph",
                  "number":"5506900140100305",
                  "securityCode":"100",
                  "expiry":{
                      "month": "05",
                      "year": "21"
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Issue:</strong> Getting the response.</p>
  
  <pre><code>{
      "error": {
          "cause": "INVALID_REQUEST",
          "explanation": "Directly providing cardholder data is not supported. Consider using a session or token."
      },
      "result": "ERROR"
  }
  </code></pre>
  
  <p>How I have obtained the Session id.!</p>
  
  <p>I have followed this guide:</p>
  
  <p><a href="https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/51/operation/Session%3a%20Create%20Session.html?locale=en_US" rel="nofollow noreferrer">https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/51/operation/Session%3a%20Create%20Session.html?locale=en_US</a></p>
  
  <hr>
  
  <p>Using Postman, i set the </p>
  
  <p>Authorization: Basic Auth as 'merchant.{your gateway merchant ID}' in the username portion and your API password in the password portion.</p>
  
  <p>Url:"<strong><a href="https://ap-gateway.mastercard.com/api/rest/version/51/merchant/" rel="nofollow noreferrer">https://ap-gateway.mastercard.com/api/rest/version/51/merchant/</a>{merchantId}/session</strong>"</p>
  
  <p>Method: <strong>POST</strong></p>
  
  <p>Body: "<strong>raw</strong>" as JSON, like so:</p>
  
  <pre><code>{
     "apiOperation": "CREATE_CHECKOUT_SESSION",
     "order": {
         "currency": "USD",
         "id": "2000",
         "amount": 5
     }
  }
  </code></pre>
  
  <p><strong>Success:</strong> Getting the response.</p>
  
  <pre><code>{
      "merchant": "merchantId",
      "result": "SUCCESS",
      "session": {
          "id": "SESSION0002210064458I18884862F9",
          "updateStatus": "SUCCESS",
          "version": "f531053101"
      },
      "successIndicator": "4c47702b70cb4f16"
  }
  </code></pre>
  
  <p>The session id i have received in above request has been passed to update session request.</p>
  
  <p>I expected the updated session with card information but getting the error: 
  "Directly providing cardholder data is not supported. Consider using a session or token."</p>