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
sandip123
04-18-2019
03:48 AM
Not able to get success when charging customer via customerApi->charge.
I am using square API sandbox crendentials for charging registered customer $result = $customersApi>charge($location_id, $body);
Getting the following error.
Fatal error: Uncaught Error: Call to undefined function charge() in /var/www/html/indoexpo/wp-content/themes/indoexpo/square-payment/tempalte-process.php:197 Stack trace: #0 /var/www/html/indoexpo/wp-includes/template-loader.php(77): include() #1 /var/www/html/indoexpo/wp-blog-header.php(19): require_once('/var/www/html/i...') #2 /var/www/html/indoexpo/index.php(17): require('/var/www/html/i...') #3 {main} thrown in /var/www/html/indoexpo/wp-content/themes/indoexpo/square-payment/tempalte-process.php on line 197
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
1 REPLY 1
Hi again @sandip123.
I escalated this to our API team and they advised that you change the line in your code from
_$result = $customersApi>charge($location_id, $body);_ to
`$result = $transactions_api->charge($location_id, $request_body);`
If you'd like to attribute a customer to a transaction then you'll need to pass a customer_id to the Charge endpoint before calling that endpoint.
(As I mentioned at the end of my last thread please note that Square's Payment API is only able to in countries where Square has support for card payments - USA, Canada, Japan, Australia and UK.)
️ Helen
Seller Community Manager
Did you find help in the Seller Community? Mark a Best Answer to help others.
Seller Community Manager
Did you find help in the Seller Community? Mark a Best Answer to help others.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report