Very quick and simple question for anyone who has used go-cardless before.
I have read the docs (I think - may have missed this :-P) and am just struggling with one point:
New Pre-authorisation sent - fine
Return to my server - fine
However - from the information sent back it does not return any identifying information for the customer other than the customers unique ID.
Soooo - how do I then confirm that person has a valid subscription / pre-authorisation?
I know I could do this via sessions and then link the ID returned to the customer that way but that seems fraught with security problems and problems if a session fails for any reason.
What is the correct way of doing this?
I am guessing that somehow I can use the unique ID returned to then request that clients actual info but I cannot find how to do this either!
https://developer.gocardless.com <- here are the documents for the company.
Please tell me I am just being thick and have missed an obvious step.
Here is what is returned after successful payment / subscription
GoCardless_PreAuthorization Object
(
[client] => GoCardless_Client Object
(
[account_details] => Array
(
[app_id] => XXXXXXX
[app_secret] => XXXXXXX
[merchant_id] => XXXXXXX
[access_token] => XXXXXXX
)
[base_url] => https://sandbox.gocardless.com
[redirect_uri] =>
)
[max_amount] => 100.0
[setup_fee] => 0.0
[currency] => GBP
[interval_length] => 1
[interval_unit] => month
[name] =>
[description] =>
[status] => active
[remaining_amount] => 100.0
[next_interval_start] => 2014-06-01T00:00:00Z
[expires_at] =>
[created_at] => 2014-05-01T07:04:20Z
[merchant_id] => XXXXXXXXXXXX
[user_id] => XXXXXXXEE54543 // this is the unique ID for user
[id] => XXXXX83854943 // // this is the unique ID for this preauthorisation.
[uri] => https://sandbox.gocardless.com/api/v1/pre_authorizations/XXXXXXX
[sub_resource_uris] => Array
(
[bills] => https://sandbox.gocardless.com/api/v1/merchants/XXXXXXXX/bills?source_id=XXXXXXXX
)
)
EDIT
I am passing the following:
$payment_details = array(
'max_amount' => '100.00',
'interval_length' => 1,
'interval_unit' => 'month',
'user' => array(
'first_name' => 'xxxx',
'last_name' => 'yyyy',
'email' => 'test@test.com'
),
'state' => 'abc123456789',
'setup_fee' => '40.00'
);
state
SHOULD get passed back -> but I am not sure why it isn't????
Thanks in advance!
p.s. no idea what tags this comes under as API is just horrific - PHP and go-cardless are best I could do!## Heading ##!!!!