Advertisement
hmunoz-stripe

Untitled

Oct 5th, 2020
1,517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. try {
  2.   $transaction = \Stripe\Charge::create([
  3.     'amount' => 100,
  4.     'currency' => "usd",
  5.     'source' => "tok_visa",
  6.     'capture' => false, // just preauth this amount
  7.   ],
  8.   ['stripe_account' => "acct_123"]);
  9.   echo "\n";
  10.   echo $transaction->id;
  11.   echo "\n";
  12.   echo $transaction->status;
  13.   echo "\n";
  14.  
  15.   $transaction = \Stripe\Charge::retrieve($transaction->id,
  16.     ['stripe_account' => "acct_123"]
  17.   );
  18.    
  19.   $transaction->capture([
  20.     'amount' => 100,
  21.    ], ['stripe_account' => "acct_123"]);
  22.    echo "\n";
  23.    echo $transaction->id;
  24.    echo "\n";
  25.   echo $transaction->status;
  26.   echo "\n\;
  27. }
  28. catch(\Exception $e) {
  29.  echo "Error: \n";
  30.  echo $e;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement