Skip to content

Instantly share code, notes, and snippets.

@dmurawsky
Created July 2, 2020 16:14
Show Gist options
  • Save dmurawsky/8148176d5c0003d3391f9cbb3d6b311e to your computer and use it in GitHub Desktop.
Save dmurawsky/8148176d5c0003d3391f9cbb3d6b311e to your computer and use it in GitHub Desktop.
Place an order for a printful item
const Axios = require('axios')
Axios({
method: 'POST',
headers: {
Authorization: 'Basic thisisyourbase64authtoken',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
data: JSON.stringify({
recipient: {
name: 'Jill Smith',
address1: '123 Main Street',
city: 'Happyton',
state_code: 'FL',
country_code: 'US',
zip: '12345',
},
items: [{ variant_id: 6882, quantity: 1, files: [{ url: 'https://lowdowntext.com/fullPage-print.pdf' }] }],
}),
url: 'https://api.printful.com/orders?confirm=1',
}).then(console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment