Timofey
12-01-2020
09:10 AM
Thread Options
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
On back we have such flow:
- Get nonce from the frontend
- Create customer
- Create card for the customer and gotten nonce
CreateCustomerCardRequest cardRequest = new CreateCustomerCardRequest().cardNonce(cardNonce);
customersApi.createCustomerCard(customerId, cardRequest);
- Make a charge with such request
Customer customer = customersApi.retrieveCustomer(clientDetails.getCustomerId()).getCustomer();
ChargeRequest chargeRequest = new ChargeRequest()
// all set fields are required for charging via TransactionAPI
.customerId(customer.getId())
.customerCardId(customer.getCards().iterator().next().getId())
.billingAddress(clientDetails.getAddress().convertToSquareAddress())
.buyerEmailAddress(clientDetails.getEmail())
.idempotencyKey(idempotencyKey)
.amountMoney(preparePaymentAmount(clientAmount, request.getCurrency()))
.note(shorten(clientDetails.getDescription()));
The charge request fails with exception:
com.squareup.connect.ApiException: {"errors":[{"category":"INVALID_REQUEST_ERROR","code":"NOT_FOUND","detail":"Card on file `ccof:aVQ2nH9JALqLueJW3GB` for customer `TXSP1QJSFGTPV72CKAYR0SFXQR` not found.","field":"customer_card_id"}]}
Help please. It seams to be a very common flow.
We make such calls not for our account but for merchant accounts that give us access by OAuth.
This code worked well before 2020-10-22 00:00 UTC.
Reply
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
1 Best Answer
ashc
12-03-2020
04:39 AM
Thread Options
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Best Answer
Hey @Timofey,
I reached out to our API Team and they said there was an issue with card on file that the team fixed today that was causing this error.
All should be working now!
Ashley C
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Reply
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
1 REPLY 1
ashc
12-03-2020
04:39 AM
Thread Options
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Best Answer
Hey @Timofey,
I reached out to our API Team and they said there was an issue with card on file that the team fixed today that was causing this error.
All should be working now!
Ashley C
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Reply
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report