# Create Card in Sandbox

**URL:** <https://developer.squareup.com/forums/t/create-card-in-sandbox/3251>\
**Category:** Questions\
**Tags:** sandbox, cards-api\
**Created:** [August 19, 2021, 12:44am UTC](https://developer.squareup.com/forums/t/create-card-in-sandbox/3251 "2021-08-19T00:44:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eburns](https://avatars.discourse-cdn.com/v4/letter/e/ccd318/32.png) [@eburns](https://developer.squareup.com/forums/u/eburns)\
**Post date:** [August 19, 2021, 12:44am UTC](https://developer.squareup.com/forums/t/create-card-in-sandbox/3251/1 "2021-08-19T00:44:55Z")

</div>

I’m trying to test creating a card using the Square sandbox with the Cards-Api and getting a “SERVICE\_UNAVAILABLE” ApiError. Are we unable to create test cards in the sandbox?

I’m using the Web Payments SDK and one of the test cards to get a source ID (Everything appears to be working correctly around this).

And Here’s the request and response:

```auto
request: {
    method: 'POST',
    url: 'https://connect.squareupsandbox.com/v2/cards',
    headers: {
      'user-agent': 'Square-TypeScript-SDK/13.0.0',
      'content-type': 'application/json',
      authorization: 'Bearer <MY-SQUARE-ACCESS-TOKEN>',
      'Square-Version': '2021-07-21',
      accept: 'application/json'
    },
    body: {
      type: 'text',
      content: '{"idempotency_key":"\\u0018\\ufffdG\\ufffd-\\ufffdA\\ufffd\\ufffd\\ufffd$\\ufffdc\\u0016\\ufffd\\ufffd","source_id":"cnon:CBASEO1q4vlyvhh56lUQlo3uVec","card":{"cardholder_name":"Test Customer","customer_id":"79DJ3YVZ1RYGZ0WDHW8431G14G","reference_id":"611d8ba2637504a33d07de79"}}'
    }
  },
  statusCode: 503,
  headers: {
    'content-type': 'application/json',
    'square-version': '2021-07-21',
    vary: 'Origin, Accept-Encoding',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-speleo-traceid': 'FSYYQHdfkhCWJ',
    'x-xss-protection': '1; mode=block',
    date: 'Thu, 19 Aug 2021 00:21:36 GMT',
    'content-length': '124',
    'strict-transport-security': 'max-age=631152000; includeSubDomains; preload',
    connection: 'close'
  },
  body: '{"errors":[{"category":"API_ERROR","code":"SERVICE_UNAVAILABLE","detail":"The Connect endpoint is currently unavailable."}]}',
  result: [Object: null prototype] { errors: [[Object: null prototype] ] },
  errors: [
    [Object: null prototype] {
      category: 'API_ERROR',
      code: 'SERVICE_UNAVAILABLE',
      detail: 'The Connect endpoint is currently unavailable.'
    }
  ]
}

```

A retry attempt yields the following error, which seems odd if the service was unavailable on the first request (I’m reusing the same idempotencyKey also):

```auto
errors: [
    [Object: null prototype] {
      category: 'INVALID_REQUEST_ERROR',
      code: 'SOURCE_USED',
      detail: 'Source was used before.',
      field: 'source_id'
    }
  ]

```

---

<div class="post-metadata">

**Author:** ![eburns](https://avatars.discourse-cdn.com/v4/letter/e/ccd318/32.png) [@eburns](https://developer.squareup.com/forums/u/eburns)\
**Post date:** [August 19, 2021, 1:51am UTC](https://developer.squareup.com/forums/t/create-card-in-sandbox/3251/2 "2021-08-19T01:51:33Z")

</div>

It looks like I get the same errors outside of the sandbox in the production environment as well, so there must be something I’m doing wrong with my create card request. (I’m able to successfully create a customer in both environments).

---

<div class="post-metadata">

**Author:** ![eburns](https://avatars.discourse-cdn.com/v4/letter/e/ccd318/32.png) [@eburns](https://developer.squareup.com/forums/u/eburns)\
**Post date:** [August 19, 2021, 4:23am UTC](https://developer.squareup.com/forums/t/create-card-in-sandbox/3251/3 "2021-08-19T04:23:55Z")

</div>

It turns out my account wasn’t fully set up for payments and that was the issue–after finishing setting that up, the cards API seems to be fully working now 🙂

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [August 19, 2021, 7:30pm UTC](https://developer.squareup.com/forums/t/create-card-in-sandbox/3251/4 "2021-08-19T19:30:17Z")

</div>

Great! Please feel free to reach out if you have any additional questions. We’re happy to help. 🙂
