How does stripe connect auth and capture works with PHP?

175 views Asked by At

I have to use stripe connect with auth and capture feature with standalone accounts in php. But when I pass the chargeID to authenticated charge to capture payment. It says no such chargeId. If someone can help me with an example of this it would be great because theory alone is not working for me. Thanks is advance.

1

There are 1 answers

0
Jaydeep Pandya On BEST ANSWER

Its better to show your code/error message here to give appropriate suggestions.

  1. Check if Pre Auth successfully done in Your Stripe Account with same ID which you are passing for capture.

  2. If yes try below code ref

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api.stripe.com/v1/charges/".$preAuthTokenId."/capture");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "your_secret_key" . ":" . "your_publishable_key");
    
    $result = curl_exec($ch);
    
    curl_close ($ch);