Search code examples
phpsquare-connect

Square v2 Charge response missing `processing_fee_money`


I'm using the square/connect php sdk and after a successful charge, it doesn't look like we are getting back the processing_fee_money key inside of the tender object.

See below:

array(
  'id' => '7XJuiX7rm2WJMSqyjtWyTl4eV',
  'location_id' => '2M3D2SZ0KC9C9',
  'created_at' => '2016-04-08T18:52:38Z',
  'tenders' => 
  array (
    0 => 
    array (
      'id' => 'ujq8ZsmEzOLbfX7ypW6wqxMF',
      'location_id' => '2M3D2SZ0KC9C9',
      'transaction_id' => '7XJuiX7rm2WJMSqyjtWyTl4eV',
      'created_at' => '2016-04-08T18:52:38Z',
      'note' => 'XXXXXXX XXXXXXXX',
      'amount_money' => 
      array (
        'amount' => 106,
        'currency' => 'USD',
      ),
      'type' => 'CARD',
      'card_details' => 
      array (
        'status' => 'CAPTURED',
        'card' => 
        array (
          'card_brand' => 'VISA',
          'last_4' => 'XXXX',
        ),
        'entry_method' => 'KEYED',
      ),
    ),
  ),
  'reference_id' => 'XXXXXXXXXXXXXXX',
  'product' => 'EXTERNAL_API'
)

It appears that a fee ($0.33) was actually incurred in this charge. According to the documentation, the processing_fee_money should be present: https://docs.connect.squareup.com/api/connect/v2/#type-tender

Am I missing something?


Solution

  • Thanks for pointing out this omission in the documentation.

    The exact Square processing fee for a transaction has not been calculated by the time the Charge endpoint returns. Consequently, the processing_fee_money field is not populated in this response.

    You can send a followup request to the RetrieveTransaction endpoint (i.e., call the retrieveTransaction method in the PHP SDK), providing the id returned by the Charge endpoint. This will return a Transaction object that does include the processing_fee_money field.