An open API service indexing awesome lists of open source software.

https://github.com/jacobbennett/stripetesttoken

Use this to quickly generate Stripe test tokens for successful or exceptional responses from Stripe.
https://github.com/jacobbennett/stripetesttoken

php stripe

Last synced: 10 months ago
JSON representation

Use this to quickly generate Stripe test tokens for successful or exceptional responses from Stripe.

Awesome Lists containing this project

README

          

![](https://raw.githubusercontent.com/JacobBennett/StripeTestToken/master/stripetesttoken-01.jpg)

# Stripe Test Tokens
[![Latest Version on Packagist](https://img.shields.io/packagist/v/jacobbennett/stripe-test-token.svg?maxAge=2592000?style=flat-square)](https://packagist.org/packages/jacobbennett/stripe-test-token)
[![Travis](https://img.shields.io/travis/JacobBennett/StripeTestToken.svg?maxAge=2592000?style=flat-square)](https://travis-ci.org/JacobBennett/StripeTestToken)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

Use this to quickly create Stripe test tokens for successful and exceptional responses from Stripe.

## Install
```bash
composer require jacobbennett/stripe-test-token
```

## Usage
```php
500,
'currency' => 'usd',
'source' => StripeTestToken::validVisa(),
]);

// Fake a Failing Charge

try {

Charge::create([
'amount' => 500,
'currency' => 'usd',
'source' => StripeTestToken::cvcFail(),
]);

} catch (\Stripe\Error\Card $e) {
// handle errors
}

```

## Docs

> Find full descriptions at original [Stripe Docs Reference](https://stripe.com/docs/testing#cards)

### Using Methods

To use any of the methods below, call the listed method as a static on the `StripeTestToken` class. If you only want to return the corresponding card number, such as with Selenium or Laravel Dusk, you can call the same method on the `StripeCardNumber` class.

```php