Jump to content

Stripe Payment works until I try destination


Go to solution Solved by 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!

  • Solution

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.