Jump to content

Stripe Payment works until I try destination


zimminy

Recommended Posts

Hi Guys,
Can someone please help me.
I have following PHP code that works fine. 
I get Stripe token, I get all good results, and see that Stripe transaction appears in my test account.
This scenario should work if:  Shelly buys widget from Paul and pays Paul directly.
I made this code to to make sure I get good results from simplest type of transaction, and I do, it works fine. 
 
\Stripe\Stripe::setApiKey(STRIPE_PRIVATE_KEY);
$charge = \Stripe\Charge::create(array(
    "amount" => $amount, // amount in cents
    "currency" => "usd",
    "source" => $token,
    "description" => $email
    )
);
 
But when I try to add these two parameters, so that:
Shelly uses Jill's site to buy widget, Jill gets 1.50 as a fee, Paul gets 18.50 for widget.
I'm Jill, and this is my code to try and send Paul his money and get my 1.50.
I don't want managed account scenario, I want direct connect so that Paul deals with refunds, etc.
Private key below is Jill's (my) private key
and the destination below is Paul's Stripe ID
 
\Stripe\Stripe::setApiKey(STRIPE_PRIVATE_KEY);
\Stripe\Charge::create(array(
  'amount' => $amount,
  'currency' => 'usd',
  'source' => $token,
  'application_fee' => $jillfee,
  'destination' => 'rp_16ElxDFGdfgFGd7jL7Vj4QU'
));

I do have a try/catch in place and when I use this catch area, I get result 5

} catch (\Stripe\Error\Card $e) {
    // Card was declined.
    $e_json = $e->getJsonBody();
    $err = $e_json['error'];
    $errors['stripe'] = $err['message'];
    echo '1 card declined';
} catch (\Stripe\Error\ApiConnection $e) {
     echo '2 Network problem, perhaps try again.';
} catch (\Stripe\Error\InvalidRequest $e) {
     echo '3 You screwed up in your programming.';
} catch (\Stripe\Error\Api $e) {
     echo '4 Stripe servers are down!';
} catch (\Stripe\Error\Base $e) {
     echo '5 Something else that is not customer fault.';
}

 

 

any help very much appreciated!

I got help via their support already. I used IRC on web https://webchat.freenode.net/   #Stripe... Support there says I am using a recipient ID for "Paul" and need to connect to Paul via their oAuth scripts, then use THAT connection id. They do not know why I am getting error code line 5.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.