x

PHP Square Payment integration

I got my key and all and it appears to work for the crappy demo they provide but one major thing they leave off is the darn price field and how to take the actual payment with a PRICE not just verifying a card with test billing codes.

 

How to I truely implement this into my web app using that demo(adding to or what not)

 

Thanks

Tags (1)
1,192 Views
Message 1 of 3
Report
2 REPLIES 2
Square Community Moderator

Hi @wgc

 

Sorry for the late reply. 


Were you able to get everything working properly? 

 

If not, try searching in the Stack Overflow Questions Board, as there might be a fellow Square Seller that had the same issue but was able to resolve it. 

1,159 Views
Message 2 of 3
Report

I'm just getting started with this, but the price to be charged is in the $request_body array they provide as a sample.  In my particular case for this, I have a single price and only one item, so I've hard coded it.  For most, I imagine you'd populate a $_POST or $_SESSION var and enter it there.  Mine looks like this:

 

$request_body = array (
  "card_nonce" => $_SESSION['nonce'],
  "amount_money" => array (
    "amount" => 4999, // pennies!
    "currency" => "USD"
  ),
  "idempotency_key" => $idempotencyKey
);

I hope this helps.

 

 

1,153 Views
Message 3 of 3
Report