Laravel-shopify-API-wrapper: Pass Charge To Shopify
I'm using this shopify api code. I've managed to get my app to install but now when I try to set up a charge for my app when I make the call I get this error:
Exception in api.php line 512: ERROR #3: <url> malformed
This is my code:
$charge_params = array ( 'recurring_application_charge' => array ( 'name' => 'Name Of Charge', 'price' => 10, 'return_url' => 'https://dev.shopify.com/show_products/', // also tried escaping the url so https:\/\/dev.shopify.com\/show_products\/ 'test' => true ) ); $charge = $sh->call(['URL' => '/admin/recurring_application_charges.json', 'METHOD' => 'GET', 'DATA' => ['charge_params' => $charge_params]], false);
Can anyone see what I'm doing wrong? I suspect it might be the way the
$charge_params is being passed in. There's no documentation on how to pass the charge data through that I can see.
Had to pass the full URL and pass the charge array slightly differently. Also changed the method to "POST".
This code did the trick:
$charge = $sh->call([ 'URL' => 'https://mystore.myshopify.com/admin/recurring_application_charges.json', 'METHOD' => 'POST', 'DATA' => array ( 'recurring_application_charge' => array ( 'name' => 'Name Of Charge', 'price' => 10, 'return_url' => 'https://dev.shopify.com/show_products/', 'test' => true ) ) ], false); print_r($charge); exit;
This returned the following:
stdClass Object ( [recurring_application_charge] => stdClass Object ( [id] => 2655692 [name] => Name Of Charge [api_client_id] => 1182423 [price] => 10.00 [status] => pending [return_url] => https://dev.shopify.com/show_products/ [billing_on] => [created_at] => 2016-08-03T13:50:11-04:00 [updated_at] => 2016-08-03T13:50:11-04:00 [test] => 1 [activated_on] => [trial_ends_on] => [cancelled_on] => [trial_days] => 0 [decorated_return_url] => https://dev.shopify.com/show_products/?charge_id=2655692 [confirmation_url] => https://mystore.myshopify.com/admin/charges/2655692/confirm_recurring_application_charge?signature=BAhpA8yFKA%3D%3D--8f87b4bd0d3cb9a588dfcb1566572731c0118776 ) )
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?