No such SKU when sku exists in both production and test

763 views
Skip to first unread message

Eric Halvorsen

unread,
Apr 9, 2017, 7:21:32 PM4/9/17
to Stripe API Discussion
Hi, I was hoping someone here could shed some light on this issue.

In my production app, I am using the live key, and have been accepting orders for a while now. However, I just earlier today got this error:

`Error: No such sku: <SKU>; a similar object exists in test mode, but a live mode key was used to make this request.`

After getting this error I hurried to run a test purchase, to make sure the app wasn't broken, and it worked fine. Further, this SKU exists in both test mode and live mode. Would this cause an issue? Should I change the sku in live mode to a different one than in test? Really grasping at straws at the moment since I'm not sure what caused this (I've received it twice now).

For reference, here is some code used to create an order (nodejs / express):

```
let createStripeOrder = (req, product, customer) => {
  let payload = {
    currency: 'usd',
    items: [
      {
        type: 'sku',
        parent: product.sku,
        quantity: req.body.quantity
      }
    ],
    shipping: {
      name: req.body.customerName,
      address: {
        line1: req.body.addressLine1,
        city: req.body.addressCity,
        country: req.body.addressCountryCode,
        postal_code: req.body.addressZip
      }
    },
    metadata: {
      customer_id: customer.id,
      coupon: req.body.coupon,
      event_id: req.body.event_id
    },
    email: req.body.email
  }
  if (req.body.coupon.length) { payload.coupon = req.body.coupon }
  return stripe.orders.create(payload)
}
```

The product is just loaded from my database. I am also running the app on heroku currently, if that makes any difference. Thanks in advance for anyone who is able to help with this.

Eric

Remi J.

unread,
Apr 9, 2017, 7:27:56 PM4/9/17
to api-d...@lists.stripe.com
Hey Eric,

This error seems to indicate that you tried to create an order but the SKU referenced exists only in Test mode and not Live mode. If it existed in Live mode it should have been found instead. You should be able to look up the failed request in your dashboard to find the exact parameters you sent to the API and confirm that this SKU doesn't exist in Live mode in your account.

Otherwise, what I'd recommend here is to contact support directly to discuss this. You would provide details around the SKU id and the failed request (req_XXXXX) that you saw with the error and our support team could investigate further.

All the best,
Remi

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Reply all
Reply to author
Forward
0 new messages