If i generate nonce from square react native sdk and then call API in app with this nonce to create card, then ccof is returned which is working fine.
However, if i send this generated nonce to my backend which is using square nodejs SDK then that SDK createCard endpoint returns error invalid source ID.
The app API call is like this
const res = await axios.post(
`${baseURL}cards`,
{
idempotency_key: key,
source_id: nonce,
card: {
customer_id: user_square_customer_id,
},
},
{
headers: {
Authorization: `Bearer ${authorizationToken}`,
'Content-Type': 'application/json',
},
}
);
The SDK call is this
const res = await client.cardsApi.createCard({
idempotencyKey: key,
sourceId: nonce,
card: { customerId: sqCustomerId },
})
Note that, SDK uses camelcase while API uses snake case.
App using direct API call (so no version)
backend using SDK: 34.0.1
If I try the SDK by sending cnon:card-nonce-ok then card is created fine. but that ccof can’t be charged as createPayment API says card not found.
Only thing working is, create nonce from React native SDK. Then save it via square API call from app (not backend). and then i can use this saved token with my backend.
Need solution for this issue? Why is my SDK rejecting the nonce?
applicationID: sandbox-sq0idb-FquB-I6tsHka31FnNqH4sA