Social Print Studio provides an API endpoint that lets external applications add products to our Shopify cart. Your app sends a simple JSON payload describing what to add, and receives a URL to redirect the customer to. The customer lands on our Shopify cart with the product already added, and can then checkout and pay for their order directly on our website. We will process and print the order and handle any customer service or issues.
You do need:
POST https://editor-staging.socialprintstudio.com/api/cart/external-app-addToCart
Content-Type: application/json
| Field | Type | Description |
|---|---|---|
sku |
string |
The Shopify product SKU. Must exactly match a variant SKU in our Shopify store. |
source |
string |
An identifier for your application (e.g. "my-app-name"). Used for tracking and debugging. |
projectData |
object |
Project/order data to persist for fulfillment. All products offered via this API are custom printed and require project data. See Project Data below. |
| Field | Type | Default | Description |
|---|---|---|---|
quantity |
number |
1 |
How many copies of this exact product to add to the cart. Must be a positive integer. |
properties |
object |
{} |
Extra key-value pairs to attach to the Shopify line item. See Line Item Properties below. |
The projectData object contains the custom content (photos, designs, etc.) that our fulfillment team needs to access when producing the order. Since all products offered via this API are custom printed, this field is required.
When you include projectData, the data is saved to our project database and a unique projectId is generated. This ID is automatically attached to the Shopify line item so our fulfillment team can access your photos and project data when producing the order.
| Field | Type | Description |
|---|---|---|
projectData.photos |
string[] |
Array of image URLs used in the product. These must be publicly accessible URLs that our fulfillment system can download when producing the order. At least one photo URL is required. If your app doesn't have its own image hosting, you can use our Image Upload API to get public URLs. |
projectData.metadata |
object |
Any arbitrary data you want to persist with the project — editor state, template options, customer preferences, etc. Can contain any JSON-serializable structure. Only several products require specific metadata; in general it is not required. |
| Requirement | Details |
|---|---|
| Formats | JPG or PNG recommended. |
| Max file size | 50 MB per image. |
| URL validity | URLs must remain publicly accessible for at least one week after the order is placed. Our fulfillment system downloads images during production, which may not happen immediately after checkout. |
The properties object lets you attach key-value string pairs directly to the Shopify cart line item. These are visible in the Shopify order admin and available to our fulfillment systems.
_ (underscore) to hide them from the customer on the storefront. Properties without the underscore prefix will be visible to the customer in their cart and order confirmation.
| Example Key | Description |
|---|---|
_project_Id |
A project ID from your app (hidden from customer, visible in our admin). Useful for troubleshooting or looking up an order later. |
_cover_preview_url |
Optional URL shown as a preview/thumbnail image of the finished product in the cart. |
Edit Project Link |
A URL that lets someone go back to your app to edit the project from the cart. |
Project Name |
An optional customer-facing name. Visible to the customer with their item in the cart (no underscore prefix = visible). |
{
"success": true,
"redirectUrl": "https://socialprintstudio.com/pages/newcart?cartKey=prod_1707400000_abc123def",
"projectId": "65a1b2c3d4e5f6a7b8c9d0e1"
}
| Field | Type | Description |
|---|---|---|
success |
boolean |
true if the item was staged successfully. |
redirectUrl |
string |
The URL to redirect the customer's browser to. This adds the item to their Shopify cart. |
projectId |
string |
The database ID of the saved project. You can store this for your own records. |
redirectUrl. The redirect URL is single-use — it works once and then expires.
| Status | Meaning |
|---|---|
400 | Missing or invalid required field (sku, source, or projectData). Check the error message for details. |
405 | Wrong HTTP method. Use POST. |
502 | The SKU could not be resolved to a Shopify product. It likely doesn't match any variant in our store. |
500 | Internal server error. Contact us if this persists. |
All error responses include an error field with a human-readable message:
{
"error": "Missing required field: \"sku\" (string). This should be the Shopify product SKU."
}
A minimal request with required fields. All products offered via this API are custom printed and require project data with at least one photo URL.
const response = await fetch(
'https://editor-staging.socialprintstudio.com/api/cart/external-app-addToCart',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sku: 'metal-print-4x4',
source: 'my-partner-app',
projectData: {
photos: [
'https://cdn.example.com/uploads/user123/photo-sunset.jpg',
],
},
}),
}
);
const { redirectUrl } = await response.json();
// Send the customer to the Shopify cart
window.location.href = redirectUrl;
A product that includes customer photos and extra metadata for fulfillment.
const response = await fetch(
'https://editor-staging.socialprintstudio.com/api/cart/external-app-addToCart',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sku: 'softcover-8x8-40',
quantity: 1,
source: 'my-partner-app',
projectData: {
photos: [
'https://cdn.example.com/uploads/user123/cover-file.jpg',
'https://cdn.example.com/uploads/user123/photo-beach-sunset.jpg',
'https://cdn.example.com/uploads/user123/photo-family-portrait.jpg',
],
metadata: {
bookTitle: 'Summer Vacation 2025',
customerNotes: 'Extra information stored on the order as a record',
},
},
properties: {
'Project Name': 'Summer Vacation 2025',
_cover_preview_url:
'https://cdn.example.com/previews/user123/cover-thumb.jpg',
},
}),
}
);
const data = await response.json();
if (!response.ok) {
console.error('Failed to add to cart:', data.error);
return;
}
// Optionally save the projectId for your own records
console.log('Project saved with ID:', data.projectId);
// Redirect the customer to the Shopify cart
window.location.href = data.redirectUrl;
const response = await fetch(
'https://editor-staging.socialprintstudio.com/api/cart/external-app-addToCart',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sku: 'photo-print-30x40',
quantity: 3,
source: 'my-partner-app',
projectData: {
photos: [
'https://cdn.example.com/photo1.jpg'
],
},
}),
}
);
const { redirectUrl } = await response.json();
window.location.href = redirectUrl;
The sku value must exactly match a product variant SKU in our Shopify store. If the SKU doesn't match, the API will return a 502 error.
Things to keep in mind:
softcover-8x8-40, classic-prints-4x4)softcover-8x8-40 is a softcover 8x8 book with 40 pages)-oatmeal, -flex)┌─────────────────────┐
│ Your Application │
│ │
│ 1. User finishes │
│ creating their │
│ product │
│ │
│ 2. POST to │
│ /api/cart/ │
│ external-app- │
│ addToCart │
│ with SKU + │
│ project data │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Our API Endpoint │
│ │
│ 3. Saves project │
│ data to our DB │
│ │
│ 4. Resolves SKU to │
│ Shopify variant │
│ │
│ 5. Stages cart │
│ items │
│ │
│ 6. Returns │
│ redirectUrl │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Your app redirects │
│ the user's browser │
│ to redirectUrl │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Shopify Cart Page │
│ │
│ 7. Fetches staged │
│ cart data │
│ │
│ 8. Adds items to │
│ the Shopify │
│ cart │
│ │
│ 9. Customer sees │
│ their cart and │
│ can check out │
└─────────────────────┘
projectData.photos.source field is important. It helps us track which app generated the order and debug issues. Pick a consistent, descriptive identifier for your app and use it on every request.projectId in the response is the database reference for the saved project. You may want to store this in your own system for debugging or support conversations.