<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>thread Charge fails with INVALID_REQUEST_ERROR in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Charge-fails-with-INVALID-REQUEST-ERROR/m-p/224003#M96894</link>
    <description>&lt;P&gt;On back we have such flow:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Get nonce from the frontend&lt;/LI&gt;
&lt;LI&gt;Create customer&lt;/LI&gt;
&lt;LI&gt;Create card for the customer and gotten nonce&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;CreateCustomerCardRequest cardRequest = &lt;SPAN&gt;new &lt;/SPAN&gt;CreateCustomerCardRequest().cardNonce(cardNonce);&lt;BR /&gt;customersApi.createCustomerCard(customerId, cardRequest);&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;Make a charge with such request&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;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()));&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The charge request fails with exception:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;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"}]}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Help please. It seams to be a very common flow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We make such calls not for our account but for merchant accounts that give us access by OAuth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code worked well before&amp;nbsp;&lt;SPAN&gt;2020-10-22 00:00 UTC.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2020 12:09:34 GMT</pubDate>
    <dc:creator>Timofey</dc:creator>
    <dc:date>2020-12-02T12:09:34Z</dc:date>
    <item>
      <title>Charge fails with INVALID_REQUEST_ERROR</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Charge-fails-with-INVALID-REQUEST-ERROR/m-p/224003#M96894</link>
      <description>&lt;P&gt;On back we have such flow:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Get nonce from the frontend&lt;/LI&gt;
&lt;LI&gt;Create customer&lt;/LI&gt;
&lt;LI&gt;Create card for the customer and gotten nonce&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;CreateCustomerCardRequest cardRequest = &lt;SPAN&gt;new &lt;/SPAN&gt;CreateCustomerCardRequest().cardNonce(cardNonce);&lt;BR /&gt;customersApi.createCustomerCard(customerId, cardRequest);&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;Make a charge with such request&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;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()));&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The charge request fails with exception:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;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"}]}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Help please. It seams to be a very common flow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We make such calls not for our account but for merchant accounts that give us access by OAuth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code worked well before&amp;nbsp;&lt;SPAN&gt;2020-10-22 00:00 UTC.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 12:09:34 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Charge-fails-with-INVALID-REQUEST-ERROR/m-p/224003#M96894</guid>
      <dc:creator>Timofey</dc:creator>
      <dc:date>2020-12-02T12:09:34Z</dc:date>
    </item>
  </channel>
</rss>

