Skip to content

Instantly share code, notes, and snippets.

@JuanRangel
Created November 21, 2017 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuanRangel/b7171fa3a995dcfd1322078a06d48292 to your computer and use it in GitHub Desktop.
Save JuanRangel/b7171fa3a995dcfd1322078a06d48292 to your computer and use it in GitHub Desktop.
A simple stub for testing against stripes api for a subscription.
$user = factory(User::class)->create(['stripe_id' => false]);
$plan = factory(Plan::class)->create(['name' => 'freelancer']);
$token = \Stripe\Token::create([
"card" => [
"number" => "4242424242424242",
"exp_month" => 1,
"exp_year" => date('Y') + 1,
"cvc" => "123"
]
], ['api_key' => config('services.stripe.secret')]);
$user->newSubscription('main', $plan->name)->create($token->id);
$this->assertTrue($user->isSubscribed());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment