title: how to generate tokens for worldpay api using c#
body: <p>i want to get token to be used in wordpay device to integrate in c# wpf application</p>
  
  <p>i have downloaded this <a href="https://github.com/worldpay/worldpay-lib-dotnet" rel="nofollow noreferrer">https://github.com/worldpay/worldpay-lib-dotnet</a> library and included it in my project </p>
  
  <pre><code>curl request to generate token is 
  url https://api.worldpay.com/v1/tokens 
  -H "Content-type: application/json" 
  -X POST 
  -d '{
      "reusable": true/false,
      "paymentMethod": {
          "name": "name",
          "expiryMonth": 2,
          "expiryYear": 2015,
          "issueNumber": 1,
          "startMonth": 2,
          "startYear": 2013,
          "cardNumber": "4444 3333 2222 1111",
          "type": "Card",
          "cvc": "123"
      },
      "clientKey": "T_C_client_key"
  }
  </code></pre>
  
  <p>i want to convert above curl request to c# to generate token.</p>
  
  <pre><code>       System.Net.ServicePointManager.SecurityProtocol = 
          SecurityProtocolType.Tls12;
          Worldpay.Sdk.WorldpayRestClient restClient = new Worldpay.Sdk.WorldpayRestClient("https://api.worldpay.com/v1", "T_S_11cca65b-c15a-467c-8561-35ecfa07725b");
  
  
          var orderRequest = new OrderRequest()
          {
              amount = 1999,
              currencyCode = CurrencyCode.GBP.ToString(),
              name = "Joe Bloggs",
              orderDescription = "Order description",
              token= "where to get this "
          };
  
          var address = new Address()
          {
              address1 = "line 1",
              address2 = "line 2",
              city = "city",
              countryCode = CountryCode.GB.ToString(),
              postalCode = "AB1 2CD"
          };
  
          orderRequest.billingAddress = address;
  
          try
          {
              OrderResponse orderResponse = restClient.GetOrderService().Create(orderRequest);
             MessageBox.Show("Order code: " + orderResponse.orderCode);
          }
          catch (WorldpayException er)
          {
              MessageBox.Show("Error code:" + er.apiError.customCode);
              MessageBox.Show("Error description: " + er.apiError.description);
              MessageBox.Show("Error message: " + er.apiError.message);
          }
  </code></pre>