Submitting an Order

The POST orders endpoint is used to post new orders to the system.

There are 4 ways to submit an order:

  • submit on credit
  • submit via Braintree JS v1 (https://www.braintreepayments.com/blog/braintree-js/)
  • submit via Braintree token
  • submit via Paypal

Note that there are places within the order and each item to put ancillary information. For instance, both the order object and item object have SourceId to store your internal ID, as well as Meta to store any other properties you wish to save against the order/items.

Submitting on Credit

An order that is submitted on credit bypasses Braintree and PayPal charging.

  • IsInTestMode - optional - a boolean which tells Gooten API not to process the payment (used for testing)
  • ShipToAddress object, with following properties:
    • FirstName - required - first name of the user
    • LastName - required - last name of the user
    • Line1 - required - shipping address line 1
    • Line2 - optional - shipping address line 2
    • City - required - shipping city
    • State - optional - shipping state (if applicable)
    • PostalCode - required - shipping postal code
    • CountryCode - required - shipping 2-letter country code
    • Email - required - user’s email
    • Phone - required - user’s phone
  • BillingAddress object, with following properties:
    • FirstName - required - first name of the user
    • LastName - required - last name of the user
    • PostalCode - required - shipping postal code
    • CountryCode - required - shipping 2-letter country code
  • Items array of objects containing the following properties:
    • SKU - required - SKU of product variant
    • ShipCarrierMethodId - required - ID of shipping carrier method
    • Quantity - required - quantity of items with this SKU
    • Images - required - list of images, each containing Index of image and ManipCommand
    • Meta - optional - a map of key/value pairs where you can submit any extra info you want attached to the item
    • SourceId - optional - a space to put your internal order item id
  • Payment object, with following properties:
    • PartnerBillingKey - a private key that should never be shared or used client-side!
  • Meta - optional - a map of key/value pairs where you can submit any extra info you want attached to the order
  • SourceId - optional - a space to put your internal order id
{
  "ShipToAddress": {
    "FirstName": "Gooten",
    "LastName": "Test",
    "Line1": "222 Broadway",
    "City": "New York",
    "State": "NY",
    "CountryCode": "US",
    "PostalCode": "10038",
    "IsBusinessAddress": false,
    "Phone": "1234567890",
    "Email": "test@gooten.com"
  },
  "BillingAddress": {
    "FirstName": "Gooten",
    "LastName": "Test",
    "Line1": "222 Broadway",
    "City": "New York",
    "State": "NY",
    "CountryCode": "US",
    "PostalCode": "10038",
    "IsBusinessAddress": false,
    "Phone": "1234567890",
    "Email": "test@gooten.com"
  },
  "IsInTestMode": true,
  "Items": [
    {
      "Quantity": 1,
      "SKU": "PhoneCase-GalaxyNote2-Matte",
      "ShipCarrierMethodId": 1,
      "Images": [
        {
          "Url": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "Index": 0,
          "ThumbnailUrl": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "ManipCommand": "",
          "SpaceId": "0"
        }
      ]
    },
    {
      "Quantity": 2,
      "SKU": "PhoneCase-Glossy-GalaxyNote3",
      "ShipCarrierMethodId": 1,
      "Images": [
        {
          "Url": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "Index": 0,
          "ThumbnailUrl": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "ManipCommand": "",
          "SpaceId": "0"
        }
      ],
      "Meta":{
        "key1":"value"
      }
    }
  ],
  "Payment": {
    "PartnerBillingKey":"super-secret!"
  },
  "Meta":{
    "key1":"value"
  }
}

Example:

This yields the response:

{
  "Id": "7-023c9dfe-2e18-4c01-93dd-883e9f2d64d5"
}

Submitting via Braintree JS v1

Again, be sure to see the Braintree documentation.

  • IsInTestMode - optional - a boolean which tells Gooten API not to process the payment (used for testing)
  • ShipToAddress object, with following properties:
    • FirstName - required - first name of the user
    • LastName - required - last name of the user
    • Line1 - required - shipping address line 1
    • Line2 - optional - shipping address line 2
    • City - required - shipping city
    • State - optional - shipping state (if applicable)
    • PostalCode - required - shipping postal code
    • CountryCode - required - shipping 2-letter country code
    • Email - required - user’s email
    • Phone - required - user’s phone
  • BillingAddress object, with following properties:
    • FirstName - required - first name of the user
    • LastName - required - last name of the user
    • PostalCode - required - shipping postal code
    • CountryCode - required - shipping 2-letter country code
  • Items array of objects containing the following properties:
    • SKU - required - SKU of product variant
    • ShipCarrierMethodId - required - ID of shipping carrier method
    • Quantity - required - quantity of items with this SKU
    • Images - required - list of images, each containing Index of image and ManipCommand
  • Payment object, with following properties:
    • BraintreeEncryptedCCNumber - required - encrypted credit card number
    • BraintreeEncryptedCCExpDate - required - encrypted expiry date of card (month/year)
    • BraintreeEncryptedCCV - required - encrypted CVV number
    • CurrencyCode - required - currency code
    • Total - required - order total
{
  "ShipToAddress": {
    "FirstName": "Gooten",
    "LastName": "Test",
    "Line1": "222 Broadway",
    "City": "New York",
    "State": "NY",
    "CountryCode": "US",
    "PostalCode": "10038",
    "IsBusinessAddress": false,
    "Phone": "1234567890",
    "Email": "test@gooten.com"
  },
  "BillingAddress": {
    "FirstName": "Gooten",
    "LastName": "Test",
    "CountryCode": "US",
    "PostalCode": "10038"
  },
  "IsInTestMode": true,
  "Items": [
    {
      "Quantity": 1,
      "SKU": "PhoneCase-GalaxyNote2-Matte",
      "ShipCarrierMethodId": 1,
      "Images": [
        {
          "Url": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "Index": 0,
          "ThumbnailUrl": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "ManipCommand": "",
          "SpaceId": "0"
        }
      ]
    },
    {
      "Quantity": 2,
      "SKU": "PhoneCase-Glossy-GalaxyNote3",
      "ShipCarrierMethodId": 1,
      "Images": [
        {
          "Url": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "Index": 0,
          "ThumbnailUrl": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "ManipCommand": "",
          "SpaceId": "0"
        }
      ]
    }
  ],
  "Payment": {
    "BraintreeEncryptedCCNumber": "$bt3|android_2_1_0$IqLBgSffLyeqKyrk0ak5oWyiRygvr1Iku8IzJ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vaN+4gTDUTxrI1yj\/jDH9NupelMBzhg2ofLFqt1CBjFKakE65nDfLaqkbz7UqzubfTpnLxc2m1f\/nRVFEdhHnXmFJRc2VoFLnqr4EZlazrOUROVgIA==$F9FTxCDWTUsZ\/0iesyArPZRcEQ3YpWN30T9gGU1fpRY=",
    "CurrencyCode": "USD",
    "Total": 52.07
  }
}

Example:

This yields the response:

{
  "Id": "7-023c9dfe-2e18-4c01-93dd-883e9f2d64d5"
}

Submitting via Braintree Token

Docs coming soon!

Submitting via Paypal

For a web/js scenario, usually it makes sense to create and submit a hidden form like this after submitting the order info to us:

<form class="js-paypal-form" style="display:none;" action="... place PayPal/Sandbox url here ..." method="post">
    <input type="hidden" name="cmd" value="_xclick" />
    <input type="hidden" name="business" value="...email..." />
    <input type="hidden" name="item_name" value="Printed Items">
    <input type="hidden" name="cbt" value="Return to the site you came from" />
    <input type="hidden" name="rm" value="1" />
    <input type="hidden" name="image_url" value="...logo url..." />
    <input type="hidden" name="currency_code" value="...currency code..." />
    <input type="hidden" name="amount" value="...total value..." />
    <input type="hidden" name="no_shipping" value="1" />
    <input type="hidden" name="return" value="...return url..." />
    <input type="hidden" name="invoice" value="...Id of order from response - in example above: 7-f0f4ffd3-2582-48c5-9d10-4c7c625e1fec..." />
    <input type="hidden" name="notify_url" value="https://api.print.io/PayPal" />
    <input type="submit" />
</form>

Notice the notify_url – after payment completes PayPal will notify our server and we remove pre-payment flag from the submitted order, and it will go into production.

  • IsPreSubmit - must be set to true
  • IsInTestMode - optional - a boolean which tells Gooten API not to process the payment (used for testing)
  • ShipToAddress object, with following properties:
    • FirstName - required - first name of the user
    • LastName - required - last name of the user
    • Line1 - required - shipping address line 1
    • Line2 - optional - shipping address line 2
    • City - required - shipping city
    • State - optional - shipping state (if applicable)
    • PostalCode - required - shipping postal code
    • CountryCode - required - shipping 2-letter country code
    • Email - required - user’s email
    • Phone - required - user’s phone
  • Items array of objects containing the following properties:
    • SKU - required - SKU of product variant
    • ShipCarrierMethodId - required - ID of shipping carrier method
    • Quantity - required - quantity of items with this SKU
    • Images - required - list of images, each containing Index of image and ManipCommand
  • Payment object, with following properties:
    • CurrencyCode - required - currency code
    • Total - required - order total
{
  "IsPreSubmit": true,
  "ShipToAddress": {
    "FirstName": "Gooten",
    "LastName": "Test",
    "Line1": "222 Broadway",
    "City": "New York",
    "State": "NY",
    "CountryCode": "US",
    "PostalCode": "10038",
    "IsBusinessAddress": false,
    "Phone": "1234567890",
    "Email": "test@gooten.com"
  },
  "IsInTestMode": true,
  "Items": [
    {
      "Quantity": 1,
      "SKU": "PhoneCase-GalaxyNote2-Matte",
      "ShipCarrierMethodId": 1,
      "Images": [
        {
          "Url": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "Index": 0,
          "ThumbnailUrl": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "ManipCommand": "",
          "SpaceId": "0"
        }
      ]
    },
    {
      "Quantity": 2,
      "SKU": "PhoneCase-Glossy-GalaxyNote3",
      "ShipCarrierMethodId": 1,
      "Images": [
        {
          "Url": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "Index": 0,
          "ThumbnailUrl": "https:\/\/printio-widget-live.s3.amazonaws.com\/200E4604-4CD5-4E0C-A131-9F5AF25006E6.jpg",
          "ManipCommand": "",
          "SpaceId": "0"
        }
      ]
    }
  ],
  "Payment": {
    "CurrencyCode": "USD",
    "Total": 52.07
  }
}

Example:

This yields the response:

{
  "Id": "7-023c9dfe-2e18-4c01-93dd-883e9f2d64d5"
}

Next Topic: Searching Orders