DRAFT - Not implemented
One-off charges
You can create one-off charges using the createCharge
function:
// Action: MyController@makeCharge:
$shop = ...;
$returnUrl = \URL::action('MyController@handleCharge');
$confirmUrl = $shop->createCharge("Setup price", 100.00, $returnUrl);
return redirect()->to($confirmUrl);
After confirming/declining the charge, Esc/Shopify will take care of attempting to activate the charge and redirect the user to $returnUrl
with the charge_id
parameter.
// Action: MyController@handleCharge:
$shop = ...;
$charge = $shop->findCharge($request->get('charge_id'));
if ($charge->status != 'active') {
// Charge declined
} else {
// Charge accepted and activated.
}