Generate client token with braintree in iOS + php -


i'm working on brain tree first time , getting issues in first step. i'm not able access drop-in functionality ios + php

i need create client token not working these code , don't understand problem. please tell me hows generate client token.

$clienttoken = braintree_clienttoken::generate(array( "customerid" => $acustomerid )); 

i came across same error in ios - xcode telling me client_token in wrong format, expecting associative array code above returns single object. try instead - worked me:

$acustomerid = '';  $clienttoken["client_token"] = braintree_clienttoken::generate(array("customerid" => $acustomerid)); return ($clienttoken); 

note i'm not setting customerid here - put 1 in, or remove entirely code i.e. remove 'array("customerid" => $acustomerid)' completely. should work either way.

nb: in server side php script, not xcode way

edit: when create customer using braintree function (either ::create or ::sale) can assign 'id' of choosing under 'customer' array e.g.:

$result = braintree_transaction::sale(array(         'amount' => $value,         'customer' => array(             'id' => $anidofyourchoosing, ) )); 

then next time create ::sale can call 'customerid' within sale array , use customer's set payment details e.g.

$result = braintree_transaction::sale(array(             'amount' => $value,             'customerid' => $anidofyourchoosing,     )     )); 

so in clienttoken case if pass value $acustomerid, search braintree vault customerid , give token customer (provided customer created). isn't explained in braintree guides @ moment. hope helps


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -