mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	stripe test
This commit is contained in:
		| @@ -2,7 +2,12 @@ | ||||
|  | ||||
| namespace App\Console\Commands; | ||||
|  | ||||
| use App\Utils\Helper; | ||||
| use Illuminate\Console\Command; | ||||
| use Stripe\Source; | ||||
| use Stripe\Stripe; | ||||
| use Stripe\StripeClient; | ||||
| use Omnipay\Omnipay; | ||||
|  | ||||
| class Test extends Command | ||||
| { | ||||
| @@ -37,5 +42,21 @@ class Test extends Command | ||||
|      */ | ||||
|     public function handle() | ||||
|     { | ||||
|         $gateway = Omnipay::create('Stripe'); | ||||
|         $gateway->setApiKey('sk_test_gDIIPtUgWZHbnTR7CUWZS8k500NsLS9SYB'); | ||||
|  | ||||
|         $formData = array('number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2030', 'cvv' => '333'); | ||||
|         $response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'USD', 'card' => $formData))->send(); | ||||
|  | ||||
|         if ($response->isRedirect()) { | ||||
|             // redirect to offsite payment gateway | ||||
|             $response->redirect(); | ||||
|         } elseif ($response->isSuccessful()) { | ||||
|             // payment was successful: update database | ||||
|             print_r($response); | ||||
|         } else { | ||||
|             // payment failed: display message to customer | ||||
|             echo $response->getMessage(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user