#stripe

/

      • derferman joined the channel
      • harold_
        I'm having to add code to the Plugin formy framework
      • for example
      • $x = Stripe_Token::create($r,$temp);
      • does that look correct, where $r is an array('customer' => '') and temp is the user's access_token
      • mahmoudimus joined the channel
      • derferman has quit
      • how do i find/get the token for my account that I want to share customers from
      • Luke joined the channel
      • Luke has quit
      • Luke joined the channel
      • markin
        That api call looks correct
      • harold_
        yes but i need the token for the main account that has the customers stored don;t i?
      • I can't find it in my settings
      • I don't quite see how this is going to work
      • the one time token generaation requires the access token of the person I am making the charge for
      • so how am I sharing customers
      • there needs to be some hook up between the customers I have on my account
      • nemothekid has quit
      • mikesea_ has quit
      • mikesea joined the channel
      • xasry has quit
      • The required stripeToken or stripeCustomer
      • mikesea has quit
      • is anyone still here?
      • Luke has quit
      • Luke joined the channel
      • henriwatson
        harold_: hey, one moment.
      • why are you manually creating tokens?
      • oh, er, never mind. you're cloning a customer.
      • let me pull up some code from when I implemented this.
      • harold_: right, so after you create the token you can call $x->id
      • harold_
        let me check
      • henriwatson
        you can then use that token to either create a customer or create a charge.
      • harold_
        no, when I debug the result var it's false
      • henriwatson
        the result of $x->id?
      • on a similar note, are you literally doing $r = array('customer' => ''); or is $r['customer'] later populated with a customer ID?
      • harold_
      • see my gist ^^^
      • wsmoak
        hi harold_
      • rburton- has quit
      • harold_
        hi
      • wsmoak
        ‘the token for the main account that has the customers’ is your api key — sk_test_sfsljfsj
      • harold_
        I'm currently starting hour 15 of my working day
      • :(
      • wsmoak
        you’re setting it there on line 3 (make sure that’s _your_ secret key, not the access_token)
      • mahmoudimus has quit
      • harold_
        yes that is my key I checked that
      • it's my test secret key found in my settings under PAI
      • API
      • wsmoak
        so what’s false/not working in the gist?
      • harold_
        the return
      • return $res;
      • wsmoak
        put in some more print statements and see what you’ve got for the parameters coming in, and each step of the way
      • harold_
        it works - the code doesn't break, but nothing is being returned
      • wsmoak
        well if it’s not returning anything, is that because it’s hitting the catch and ‘return false’ ?
      • harold_
        yes i think so
      • debug my api key sk_test_***** - confirmed this imy API key
      • debug $r = array( 'customer' => 'cus_52Gvch2nlDLT1r' )
      • wsmoak
        the Exception itself should tell you what’s wrong, if you are hitting the catch statement
      • harold_
        Stripe_InvalidRequestError Object ( [message:protected] => Must provide Stripe Connect OAuth key to be able to use customer parameter. See https://stripe.com/docs/api#create_card_token for more details
      • that the first line of a massive chunk of text
      • wsmoak
        yes! so what’s the value of $token in there ?
      • harold_
        sk_test_rlAP0vI7rqBh6mMHlptx1EE3
      • which is the access_token of of the person I am paying
      • got from the Stripe Connect hook-up
      • so i really can't see what i am doing wrong
      • everything is in place as per the docs
      • derferman joined the channel
      • wsmoak
        take that customer and that key and try it at the command line with curl, or in irb with ruby
      • or just in a test.php page with nothing else involved
      • harold_
        i'm not familiar with curl
      • wsmoak
        the test.php is probably your best bet. simplest possible example.
      • harold_
        I got another response: Must provide Stripe Connect OAuth key to be able to use customer parameter
      • wsmoak
        that’s the same thing you got earlier. it doesn’t like that access_token
      • but… actually it sounds like it’s missing from the text of the error. let me test and see…
      • harold_
        "Ok, figured it out myself... I was using the secret and publishable keys from the user account settings page (not the one from the application owners account) but it HAS to be the OAuth token (which looks exactly the same) from the OAuth workflow."
      • i found that on Google
      • i'm using the one form the OPAuth for sure
      • derferman has quit
      • Luke has quit
      • wsmoak
        yes, it has to be the access_token from the oauth flow. so it’s working now?
      • harold_
        ok now I have payments being made
      • but they are going to my account
      • not to the supplier
      • geez
      • mahmoudimus joined the channel
      • danielstjules joined the channel
      • wsmoak
        paste what is in the log? I think you will see something on your account.
      • hey I got the same error! And I thought that was a good access_token, too...
      • also, what is the code where you did the charge?
      • harold_
        ok i forgot i have to get the token from thisf unction THEN make payment
      • 15 hours in and I'm losing it haha
      • let me just test something
      • netcarver has quit
      • i hooked up the account a second time and got anew key: sk_test_xAo92HVcvmlRidsjzo3Jawtf
      • wsmoak
        you might also change that variable name to $access_token . usually when we say $token we mean the representation of a card.
      • harold_
        that one doesn't give me the false reply when i generate a token
      • so now i nee dot test the charge with the new token it gives me
      • wsmoak
        yes. now you’ve got a token you can use as a ‘card’.
      • are you taking an application_fee? (I hope so, after all this work!)
      • ghufran joined the channel
      • wsmoak_ joined the channel
      • wsmoak_ has quit
      • wsmoak_ joined the channel
      • wsmoak has quit
      • wsmoak_ is now known as wsmoak
      • max-b_ has quit
      • harold_
        wsmoak: application fee, is that when you split the payment and take cut?
      • it this stage no
      • but in the future no doubt
      • wsmoak
        harold_: okay. it’s working for me — token from an existing customer, and then make a charge that belongs to a connected account.
      • only I took my $1.95 out :)
      • harold_
        haha ok
      • so how how are you making the charge
      • I still can;t make the charge
      • wsmoak
        let me do it without the application fee, hold on.
      • harold_
        I call the function with amount, customer_id (who is paying), a description
      • then a second parameter which is the token I generated in the previous step
      • wsmoak
        no… that token you just generated is a *card*. (that’s why you need to rename the other one access_token)
      • to make the charge, just card => $token-you-generated (I think you called it $res ? )
      • rather… $token-you-generated->id
      • harold_
        ermmm
      • wsmoak
        then amount, currency, description
      • harold_
        ok what doi need to rename access_token
      • wsmoak
        the one that’s being passed into your function. token($id,$token)
      • that’s actually token($customer_id, $access_token) right? (or maybe $id is an array of some kind)
      • then the thing you get back from Stripe_Token::… is the token-that-represents-a-card
      • hybrdthry911 joined the channel
      • joshmbrown joined the channel
      • harold_
        ok so how do i make my charge now with that card_token
      • wsmoak
        just pasting, hold please
      • harold_
        thx
      • wsmoak
      • you need the access_token again when you make the charge, even if you’re not taking a fee
      • on the connected account, it is *just* a payment. no customer.
      • danielstjules has quit
      • harold_
        wsmoak: is the access_token the same one I used to generate the card_token in the previous step?
      • wsmoak
        yes. it’s basically an alternate secret key for the connected account.
      • harold_
        ok let's test this!"
      • The required stripeToken or stripeCustomer fields are missing
      • wsmoak
        how close is your code to my code? :)
      • harold_
        hang on I think this is related to the way the plugin creates the arrays
      • if (isset($data['stripeToken'])) { $chargeData['card'] = $data['stripeToken'];
      • looks like it wants stripeToken to be loaded with data
      • wsmoak
        okay, then use that variable name for the Stripe_Token::create ?
      • joshmbrown has quit
      • or, no… you’d need to put it in the $data array from what that looks like
      • joshmbrown joined the channel
      • harold_
        this is the structure of my array