Issuing
Testing

Testing

Learn how to test your integration and simulate purchases.

You can issue cards and simulate purchases using your own Stripe integration in test mode. This allows you to test your integration before you go live without having to make real purchases. You can only use these cards for testing within your Stripe account and not for external purchases.

Use test mode top-ups to fund your Issuing balance before creating test mode transactions.

You can simulate a card purchase by specifying authorization details in the Dashboard.

1 Create a card Dashboard

Use the API or Dashboard to create a cardholder and card in test mode.

2 Create a test authorization Dashboard

In the Dashboard, first make sure you’re viewing test data. Go to the Issuing Cards page, find your newly-created card, and scroll to the Authorizations section. Then click Create test authorization.

This modal allows you to specify custom values for the test authorization you want to create.

Click submit to create the the authorization. If you’ve configured your synchronous webhook, you can use it to approve or decline. The browser will redirect to the details page for the newly-created authorization.

The details for your newly-created authorization.

3 Viewing transaction details Dashboard

The authorization is automatically captured, and a corresponding transaction is created. You can view more details on the Transactions page in the Dashboard.

The details for your newly-created transaction.

You can simulate a card purchase using your test API keys with the following process:

  1. Fund your issuing balance.
  2. Create a cardholder.
  3. Create a card.
  4. Retrieve the new card’s details.
  5. Create a customer.
  6. Create a PaymentMethod object using the card.
  7. Create an uncaptured PaymentIntent using the PaymentMethod.

1 Fund your issuing balance

To fund your issuing balance, create a top-up with the destination_balance set to “issuing.”

2 Create a cardholder Server-side

Create a cardholder with a name, billing address, and entity type. You can also provide additional information, if necessary.

curl https://api.stripe.com/v1/issuing/cardholders \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d name="Jenny Rosen" \ -d email="jenny.rosen@example.com" \ -d phone_number="+18008675309" \ -d status=active \ -d type=individual \ -d "billing[address][line1]"="1234 Main Street" \ -d "billing[address][city]"="San Francisco" \ -d "billing[address][state]"=CA \ -d "billing[address][postal_code]"=94111 \ -d "billing[address][country]"=US
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' cardholder = Stripe::Issuing::Cardholder.create({ name: 'Jenny Rosen', email: 'jenny.rosen@example.com', phone_number: '+18008675309', status: 'active', type: 'individual', billing: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' cardholder = stripe.issuing.Cardholder.create( name='Jenny Rosen', email='jenny.rosen@example.com', phone_number='+18008675309', status='active', type='individual', billing={ 'address': { 'line1': '1234 Main Street', 'city': 'San Francisco', 'state': 'CA', 'postal_code': '94111', 'country': 'US' } } )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $cardholder = \Stripe\Issuing\Cardholder::create([ 'name' => 'Jenny Rosen', 'email' => 'jenny.rosen@example.com', 'phone_number' => '+18008675309', 'status' => 'active', 'type' => 'individual', 'billing' => [ 'address' => [ 'line1' => '1234 Main Street', 'city' => 'San Francisco', 'state' => 'CA', 'postal_code' => '94111', 'country' => 'US', ], ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CardholderCreateParams params = CardholderCreateParams.builder() .setName("Jenny Rosen") .setEmail("jenny.rosen@example.com") .setPhoneNumber("+18008675309") .setStatus(CardholderCreateParams.Status.ACTIVE) .setType(CardholderCreateParams.Type.INDIVIDUAL) .setBilling( CardholderCreateParams.Billing.builder() .setAddress( CardholderCreateParams.Billing.Address.builder() .setLine1("1234 Main Street") .setCity("San Francisco") .setState("CA") .setPostalCode("94111") .setCountry("US") .build()) .build()) .build(); Cardholder cardholder = Cardholder.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const cardholder = await stripe.issuing.cardholders.create({ name: 'Jenny Rosen', email: 'jenny.rosen@example.com', phone_number: '+18008675309', status: 'active', type: 'individual', billing: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.IssuingCardholderParams{ Billing: &stripe.IssuingCardholderBillingParams{ Address: &stripe.AddressParams{ Country: stripe.String("US"), Line1: stripe.String("1234 Main Street"), City: stripe.String("San Francisco"), PostalCode: stripe.String("94111"), State: stripe.String("CA"), }, }, Email: stripe.String("jenny.rosen@example.com"), Name: stripe.String("Jenny Rosen"), PhoneNumber: stripe.String("+18008675309"), Status: stripe.String(string(stripe.IssuingCardholderStatusActive)), Type: stripe.String(string(stripe.IssuingCardholderTypeIndividual)), } ch, err := cardholder.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new CardholderCreateOptions { Billing = new CardholderBillingOptions { Address = new AddressOptions { Line1 = "1234 Main Street", City = "San Francisco", State = "CA", PostalCode = "94111", Country = "US", }, }, Email = "jenny.rosen@example.com", PhoneNumber = "+18008675309", Name = "Jenny Rosen", Status = "active", Type = "individual", }; var service = new CardholderService(); var cardholder = service.Create(options);

3 Create a card Server-side

After creating a cardholder, you can create a card for them. Provide the id of the Cardholder object and currency. For immediate testing, create a virtual card and set its status to active.

curl https://api.stripe.com/v1/issuing/cards \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d cardholder=ich_1Cm3pZIyNTgGDVfzI83rasFP \ -d type=virtual \ -d currency=usd \ -d status=active
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card = Stripe::Issuing::Card.create({ cardholder: 'ich_1Cm3pZIyNTgGDVfzI83rasFP', type: 'virtual', currency: 'usd', status: 'active', })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card = stripe.issuing.Card.create( cardholder='ich_1Cm3pZIyNTgGDVfzI83rasFP', type='virtual', currency='usd', status='active' )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $card = \Stripe\Issuing\Card::create([ 'cardholder' => 'ich_1Cm3pZIyNTgGDVfzI83rasFP', 'type' => 'virtual', 'currency' => 'usd', 'status' => 'active', ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CardCreateParams params = CardCreateParams.builder() .setCardholder("ich_1Cm3pZIyNTgGDVfzI83rasFP") .setType(CardCreateParams.Type.VIRTUAL) .setCurrency("usd") .setStatus(CardCreateParams.Status.ACTIVE) .build(); Card card = Card.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const card = await stripe.issuing.cards.create({ cardholder: 'ich_1Cm3pZIyNTgGDVfzI83rasFP', type: 'virtual', currency: 'usd', status: 'active', });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.IssuingCardParams{ Cardholder: stripe.String("ich_1Cm3pZIyNTgGDVfzI83rasFP"), Currency: stripe.String(string(stripe.CurrencyUSD)), Type: stripe.String(string(stripe.IssuingCardTypeVirtual)), Status: stripe.String(string(stripe.IssuingCardStatusActive)), } c, err := card.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new CardCreateOptions { Cardholder = "ich_1Cm3pZIyNTgGDVfzI83rasFP", Type = "virtual", Currency = "usd", Status = "active", }; var service = new CardService(); var card = service.Create(options);

4 Retrieve card details Server-side

You can retrieve both the full unredacted card number and CVC from the API. For security reasons, they’re only available for virtual cards and will be omitted unless you explicitly request them with the expand parameter. Additionally, they’re only available via the “Retrieve a card” endpoint.

curl https://api.stripe.com/v1/issuing/cards/ic_1Cm3paIyNTgGDVfzBqq1uqxR \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d "expand[]"=number \ -d "expand[]"=cvc \ -G
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card_details = Stripe::Issuing::Card.retrieve({ id: 'ic_1Cm3paIyNTgGDVfzBqq1uqxR', expand: ['number', 'cvc'], })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card_details = stripe.issuing.Card.retrieve( 'ic_1Cm3paIyNTgGDVfzBqq1uqxR', expand=['number', 'cvc'] )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $card = \Stripe\Issuing\Card::retrieve([ 'id' => 'ic_1Cm3paIyNTgGDVfzBqq1uqxR', 'expand' => ['number', 'cvc'], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CardRetrieveParams params = CardRetrieveParams.builder() .addAllExpand(Arrays.asList("number", "cvc")) .build(); Card card = Card.retrieve("ic_1Cm3paIyNTgGDVfzBqq1uqxR", params, null);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const card_details = await stripe.issuing.cards.retrieve('ic_1CoYuRKEl2ztzE5GIEDjQiUI', { expand: ['number', 'cvc'], });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.IssuingCardParams{} params.AddExpand("number") params.AddExpand("cvc") c, err := card.Get("ic_1CoYuRKEl2ztzE5GIEDjQiUI", params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new CardService(); var options = new CardGetOptions(); options.AddExpand("number"); options.AddExpand("cvc"); var details = service.Get("ic_1CoYuRKEl2ztzE5GIEDjQiUI", options);

5 Create a customer Server-side

Create a customer with a name, address, and description. You can also provide additional information, if necessary.

curl https://api.stripe.com/v1/customers \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d name="Jenny Rosen" \ -d email="jenny.rosen@example.com" \ -d phone="+18008675309" \ -d description="Issuing Cardholder" \ -d "address[line1]"="1234 Main Street" \ -d "address[city]"="San Francisco" \ -d "address[state]"=CA \ -d "address[postal_code]"=94111 \ -d "address[country]"=US
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' customer = Stripe::Customer.create({ name: 'Jenny Rosen', email: 'jenny.rosen@example.com', phone: '+18008675309', description: 'Issuing Cardholder', address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' customer = stripe.Customer.create( name='Jenny Rosen', email='jenny.rosen@example.com', phone='+18008675309', description='Issuing Cardholder', address={ 'line1': '1234 Main Street', 'city': 'San Francisco', 'state': 'CA', 'postal_code': '94111', 'country': 'US' }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $customer = \Stripe\Customer::create([ 'name' => 'Jenny Rosen', 'email' => 'jenny.rosen@example.com', 'phone' => '+18008675309', 'description' => 'Issuing Cardholder', 'address' => [ 'line1' => '1234 Main Street', 'city' => 'San Francisco', 'state' => 'CA', 'postal_code' => '94111', 'country' => 'US', ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CustomerCreateParams params = CustomerCreateParams.builder() .setName("Jenny Rosen") .setEmail("jenny.rosen@example.com") .setPhone("+18008675309") .setDescription("Issuing Cardholder") .setAddress( CustomerCreateParams.Address.builder() .setLine1("1234 Main Street") .setCity("San Francisco") .setState("CA") .setPostalCode("94111") .setCountry("US") .build()) .build(); Customer customer = Customer.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const customer = await stripe.customers.create({ name: 'Jenny Rosen', email: 'jenny.rosen@example.com', phone: '+18008675309', description: 'Issuing Cardholder', address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.CustomerParams{ Address: &stripe.AddressParams{ Country: stripe.String("US"), Line1: stripe.String("1234 Main Street"), City: stripe.String("San Francisco"), PostalCode: stripe.String("94111"), State: stripe.String("CA"), }, Name: stripe.String("Jenny Rosen"), Email: stripe.String("jenny.rosen@example.com"), Phone: stripe.String("+18008675309"), Description: stripe.String("Issuing Cardholder"), } cus, err := customer.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new CustomerCreateOptions { Address = new AddressOptions { Line1 = "1234 Main Street", City = "San Francisco", State = "CA", PostalCode = "94111", Country = "US", }, Name = "Jenny Rosen", Email = "jenny.rosen@example.com", Phone = "+18008675309", Description = "Issuing Cardholder", }; var service = new CustomerService(); var customer = service.Create(options);

6 Create a PaymentMethod Server-side

Create a PaymentMethod using the newly issued card’s details. A PaymentMethod allows you to create a test payment by simulating the swipe or entry of an issued card at the time of purchase. You can use a PaymentMethod with PaymentIntents to collect payments. You can also save a PaymentMethod to a Customer object and use it for future payments. If you provide address details or a CVC, these will be compared to the values that you define when creating the card, and the comparison results will be returned.

curl https://api.stripe.com/v1/payment_methods \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d type=card \ -d "card[number]"=4000009990000006 \ -d "card[exp_month]"=8 \ -d "card[exp_year]"=2022
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' payment_method = Stripe::PaymentMethod.create({ type: 'card', card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' payment_method = stripe.PaymentMethod.create( type='card', card={ 'number': '4000009990000006', 'exp_month': 8, 'exp_year': 2022, }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $payment_method = \Stripe\PaymentMethod::create([ 'type' => 'card', 'card' => [ 'number' => '4000009990000006', 'exp_month' => 8, 'exp_year' => 2022, ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; PaymentMethodCreateParams params = PaymentMethodCreateParams.builder() .setType(PaymentMethodCreateParams.Type.CARD) .setCard( PaymentMethodCreateParams.CardDetails.builder() .setNumber("4000009990000006") .setExpMonth(8L) .setExpYear(2022L) .build()) .build(); PaymentMethod paymentMethod = PaymentMethod.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const paymentMethod = await stripe.paymentMethods.create({ type: 'card', card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.PaymentMethodParams{ Type: stripe.String("card"), Card: &stripe.PaymentMethodCardParams{ Number: stripe.String("4000009990000006"), ExpMonth: stripe.String("8"), ExpYear: stripe.String("2022"), }, } pm, err := paymentmethod.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new PaymentMethodCreateOptions { Type = "card", Card = new PaymentMethodCardOptions { Number = "4000009990000006", ExpMonth = 8, ExpYear = 2022, }, }; var service = new PaymentMethodService(); var paymentMethod = service.Create(options);

7 Create an uncaptured PaymentIntent Server-side

Create a PaymentIntent that is not immediately captured using auth and capture. By setting confirm as true, the PaymentIntent is created and confirmed within the same step. Providing the setup_future_usage parameter along with a Customer ID saves the resulting PaymentMethod to that Customer after the PaymentIntent has been confirmed and the customer completes any required actions.

curl https://api.stripe.com/v1/payment_intents \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d payment_method=pm_1Guknr2eZvKYlo2COUU0HvEF \ -d amount=2000 \ -d currency=usd \ -d "payment_method_types[]"=card \ -d capture_method=manual \ -d setup_future_usage=off_session \ -d customer=cus_1Cm3pZIyNTgGDVfzI83rasFP \ -d confirm=true
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' intent = Stripe::PaymentIntent.create({ payment_method: 'pm_1Guknr2eZvKYlo2COUU0HvEF', amount: 2000, currency: 'usd', payment_method_types: ['card'], capture_method: 'manual', setup_future_usage: 'off_session', customer: 'cus_1Cm3pZIyNTgGDVfzI83rasFP', confirm: true, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' intent = stripe.PaymentIntent.create( payment_method='pm_1Guknr2eZvKYlo2COUU0HvEF', amount=2000, currency='usd', payment_method_types=['card'], capture_method='manual', setup_future_usage='off_session', customer='cus_1Cm3pZIyNTgGDVfzI83rasFP', confirm=True, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $intent = \Stripe\PaymentIntent::create([ 'payment_method' => 'pm_1Guknr2eZvKYlo2COUU0HvEF', 'amount' => 2000, 'currency' => 'usd', 'payment_method_types' => ['card'], 'capture_method' => 'manual', 'setup_future_usage' => 'off_session', 'customer' => 'cus_1Cm3pZIyNTgGDVfzI83rasFP', 'confirm' => true, ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; PaymentIntentCreateParams params = PaymentIntentCreateParams.builder() .setPaymentMethod("pm_1Guknr2eZvKYlo2COUU0HvEF") .setAmount(2000L) .setCurrency("usd") .addPaymentMethodType("card") .setCaptureMethod(PaymentIntentCreateParams.CaptureMethod.MANUAL) .setSetupFutureUsage(PaymentIntentCreateParams.SetupFutureUsage.OFF_SESSION) .setCustomer("cus_1Cm3pZIyNTgGDVfzI83rasFP") .setConfirm(true) .build(); PaymentIntent paymentIntent = PaymentIntent.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const intent = await stripe.paymentIntents.create({ payment_method: 'pm_1Guknr2eZvKYlo2COUU0HvEF', amount: 2000, currency: 'usd', payment_method_types: ['card'], capture_method: 'manual', setup_future_usage: 'off_session', customer: 'cus_1Cm3pZIyNTgGDVfzI83rasFP', confirm: true, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.PaymentIntentParams{ PaymentMethod: stripe.String("pm_1Guknr2eZvKYlo2COUU0HvEF"), Amount: stripe.Int64(2000), Currency: stripe.String(string(stripe.CurrencyUSD)), PaymentMethodTypes: stripe.StringSlice([]string{ "card", }), CaptureMethod: stripe.String(string(stripe.PaymentIntentCaptureMethodManual)), SetupFutureUsage: stripe.String(string(stripe.PaymentIntentSetupFutureUsageOffSession)), Customer: stripe.String("cus_1Cm3pZIyNTgGDVfzI83rasFP"), Confirm: stripe.Bool(true), } intent, err := paymentintent.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new PaymentIntentCreateOptions { PaymentMethod = "pm_1Guknr2eZvKYlo2COUU0HvEF", Amount = 2000, Currency = "usd", SetupFutureUsage = "off_session", PaymentMethodTypes = new List<string> { "card", }, CaptureMethod = "manual", Customer = "cus_1Cm3pZIyNTgGDVfzI83rasFP", Confirm = true, }; var service = new PaymentIntentService(); var paymentIntent = service.Create(options);

This step results in an authorization request. If the card has any spending controls, they’re evaluated first. If your integration is configured to receive and handle authorization requests, Stripe also sends the issuing_authorization.request event to your test authorization endpoint if the authorization is allowed by spending limits.

You can test international purchases by creating a PaymentIntent in a currency that’s different from the card’s own currency (e.g., create a gbp PaymentIntent for a usd card).

Managing purchases with the API

You can test how your integration handles changes to authorizations by replicating the possible actions that can occur.

Capturing an authorization (uncaptured PaymentIntent)

To settle an uncaptured PaymentIntent, which results in the creation of a Transaction object, capture the PaymentIntent.

curl https://api.stripe.com/v1/payment_intents/pi_1GuO8F2eZvKYlo2CX0g1JWKD/capture \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -X POST
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' intent = Stripe::PaymentIntent.capture('pi_1GuO8F2eZvKYlo2CX0g1JWKD')
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' intent = stripe.PaymentIntent.capture('pi_1GuO8F2eZvKYlo2CX0g1JWKD')
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $intent = \Stripe\PaymentIntent::retrieve('pi_1GuO8F2eZvKYlo2CX0g1JWKD'); $intent->capture();
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; PaymentIntent intent = PaymentIntent.retrieve( "pi_1GuO8F2eZvKYlo2CX0g1JWKD" ); intent.capture();
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const intent = await stripe.paymentIntents.capture('pi_1GuO8F2eZvKYlo2CX0g1JWKD');
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" pi, err := paymentintent.Capture("pi_1GuO8F2eZvKYlo2CX0g1JWKD", nil)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new PaymentIntentService(); var intent = service.Capture("pi_1GuO8F2eZvKYlo2CX0g1JWKD");

Partial capture

You can capture an authorization for an amount below what’s been authorized. You can partially capture a test PaymentIntent by providing a value for amount_to_capture when capturing a PaymentIntent.

Partially capturing a PaymentIntent creates a Transaction object for the amount captured, and a reversal of the remaining amount. This reversal is represented as an update to the Authorization object.

Reversing an authorization

You can reverse (i.e., void) an authorization that hasn’t been captured by canceling the uncaptured PaymentIntent.

curl https://api.stripe.com/v1/payment_intents/pi_1GuO8F2eZvKYlo2CX0g1JWKD/cancel \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -X POST
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' intent = Stripe::PaymentIntent.cancel('pi_1GuO8F2eZvKYlo2CX0g1JWKD')
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' intent = stripe.PaymentIntent.cancel('pi_1GuO8F2eZvKYlo2CX0g1JWKD')
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $intent = \Stripe\PaymentIntent::retrieve('pi_1GuO8F2eZvKYlo2CX0g1JWKD'); $intent->cancel();
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; PaymentIntent intent = PaymentIntent.retrieve("pi_1GuO8F2eZvKYlo2CX0g1JWKD"); intent.cancel();
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const paymentIntent = await stripe.paymentIntents.cancel('pi_1GuO8F2eZvKYlo2CX0g1JWKD');
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" intent, err := paymentintent.Cancel("pi_1GuO8F2eZvKYlo2CX0g1JWKD", nil)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new PaymentIntentService(); var options = new PaymentIntentCancelOptions{}; var intent = service.Cancel("pi_1GuO8F2eZvKYlo2CX0g1JWKD", options);

Refunding a captured PaymentIntent

You can refund a captured PaymentIntent by creating a refund. A Transaction object of type refund is created that references the original authorization.

curl https://api.stripe.com/v1/refunds \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d payment_intent=pi_1GuO8F2eZvKYlo2CX0g1JWKD \ -d amount=2000
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' refund = Stripe::Refund.create({ payment_intent: 'pi_1GuO8F2eZvKYlo2CX0g1JWKD', amount: 2000, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' refund = stripe.Refund.create( payment_intent='pi_1GuO8F2eZvKYlo2CX0g1JWKD', amount=2000, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $refund = \Stripe\Refund::create([ 'payment_intent' => 'pi_1GuO8F2eZvKYlo2CX0g1JWKD', 'amount' => 2000, ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; RefundCreateParams params = RefundCreateParams.builder() .setPaymentIntent("pi_1GuO8F2eZvKYlo2CX0g1JWKD") .setAmount(2000L) .build(); Refund refund = Refund.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const refund = await stripe.refunds.create({ payment_intent: 'pi_1GuO8F2eZvKYlo2CX0g1JWKD', amount: 2000, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.RefundParams{ PaymentIntent: stripe.String("pi_1GuO8F2eZvKYlo2CX0g1JWKD"), Amount: stripe.Int64(2000), } ref, err := refund.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new RefundCreateOptions { PaymentIntent = "pi_1GuO8F2eZvKYlo2CX0g1JWKD", Amount = 2000, }; var service = new RefundService(); var refund = service.Create(options);

Testing verification outcomes

Issued cards support AVS and CVC checks. You can simulate authorizations that either provide the wrong information so these checks fail, or no information so the checks can’t be run. The results of these checks are represented on Authorization objects as values for verification_data.

When creating a PaymentMethod object for an issued card, providing address and CVC information is optional. If they’re not provided, the resulting ZIP code, street address, and CVC checks return not_provided. To test AVS and CVC checks, provide an address, a CVC, or both during PaymentMethod creation.

curl https://api.stripe.com/v1/payment_methods \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d type=card \ -d "card[number]"=4000009990000006 \ -d "card[exp_month]"=8 \ -d "card[exp_year]"=2022 \ -d "card[cvc]"=123 \ -d "billing_details[address][line1]"="1234 Main Street" \ -d "billing_details[address][city]"="San Francisco" \ -d "billing_details[address][state]"=CA \ -d "billing_details[address][postal_code]"=94111 \ -d "billing_details[address][country]"=US
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' payment_method = Stripe::PaymentMethod.create({ card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, cvc: 123, }, type: 'card', billing_details: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' payment_method = stripe.PaymentMethod.create( type='card', card={ 'number': '4000009990000006', 'exp_month': 8, 'exp_year': 2022, 'cvc': 123, }, billing_details={ 'address': { 'line1': '1234 Main Street', 'city': 'San Francisco', 'state': 'CA', 'postal_code': '94111', 'country': 'US', }, }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $payment_method = \Stripe\PaymentMethod::create([ 'type' => 'card', 'card' => [ 'number' => '4000009990000006', 'exp_month' => 8, 'exp_year' => 2022, 'cvc' => 123, ], 'billing_details' => [ 'address' => [ 'line1' => '1234 Main Street', 'city' => 'San Francisco', 'state' => 'CA', 'postal_code' => '94111', 'country' => 'US', ], ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; PaymentMethodCreateParams params = PaymentMethodCreateParams.builder() .setType(PaymentMethodCreateParams.Type.CARD) .setBillingDetails( PaymentMethodCreateParams.BillingDetails.builder() .setAddress( PaymentMethodCreateParams.BillingDetails.Address.builder() .setLine1("1234 Main Street") .setCity("San Francisco") .setState("CA") .setPostalCode("94111") .setCountry("US") .build()) .build()) .putExtraParam("card[number]", "4000009990000006") .putExtraParam("card[exp_month]", "8") .putExtraParam("card[exp_year]", "2022") .putExtraParam("card[cvc]", "314") .build(); PaymentMethod paymentMethod = PaymentMethod.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const paymentMethod = await stripe.paymentMethods.create({ type: 'card', card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, cvc: 123, }, billing_details: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.PaymentMethodParams{ Type: stripe.String("card"), Card: &stripe.PaymentMethodCardParams{ Number: stripe.String("4000009990000006"), ExpMonth: stripe.String("8"), ExpYear: stripe.String("2022"), CVC: stripe.String("123"), }, BillingDetails: &stripe.BillingDetailsParams{ Address: &stripe.AddressParams{ Line1: stripe.String("1234 Main Street"), City: stripe.String("San Francisco"), PostalCode: stripe.String("94111"), State: stripe.String("CA"), Country: stripe.String("US"), }, }, } pm, err := paymentmethod.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new PaymentMethodCreateOptions { Type = "card", Card = new PaymentMethodCardOptions { Number = "4000009990000006", ExpMonth = 8, ExpYear = 2022, Cvc = "123", }, BillingDetails = new PaymentMethodBillingDetailsOptions { Address = new AddressOptions { Line1 = "1234 Main Street", City = "San Francisco", PostalCode = "94111", State = "CA", Country = "US", }, }, }; var service = new PaymentMethodService(); var paymentMethod = service.Create(options);

Providing the same address as the billing address on the card results in a successful AVS check (the respective verification_data fields return match) and providing the correct CVC (the value returned in the card details) does the same for the CVC check.

To test for a failed check, create a PaymentMethod that has a different ZIP code, street address, and CVC—this results in verification_data returning mismatch.

You can simulate a card purchase using your test API keys with the following process:

  1. Fund your issuing balance.
  2. Create a cardholder.
  3. Create a card.
  4. Retrieve the new card’s details.
  5. Create a Source object using the card.
  6. Create an uncaptured charge using the source.

1 Fund your issuing balance

To fund your issuing balance, create a top-up with the destination_balance set to “issuing.”

2 Create a cardholder Server-side

Create a cardholder with a name, billing address, and entity type. You can also provide additional information, if necessary.

curl https://api.stripe.com/v1/issuing/cardholders \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d name="Jenny Rosen" \ -d email="jenny.rosen@example.com" \ -d phone_number="+18008675309" \ -d status=active \ -d type=individual \ -d "billing[address][line1]"="1234 Main Street" \ -d "billing[address][city]"="San Francisco" \ -d "billing[address][state]"=CA \ -d "billing[address][postal_code]"=94111 \ -d "billing[address][country]"=US
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' cardholder = Stripe::Issuing::Cardholder.create({ name: 'Jenny Rosen', email: 'jenny.rosen@example.com', phone_number: '+18008675309', status: 'active', type: 'individual', billing: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' cardholder = stripe.issuing.Cardholder.create( name='Jenny Rosen', email='jenny.rosen@example.com', phone_number='+18008675309', status='active', type='individual', billing={ 'address': { 'line1': '1234 Main Street', 'city': 'San Francisco', 'state': 'CA', 'postal_code': '94111', 'country': 'US' } } )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $cardholder = \Stripe\Issuing\Cardholder::create([ 'name' => 'Jenny Rosen', 'email' => 'jenny.rosen@example.com', 'phone_number' => '+18008675309', 'status' => 'active', 'type' => 'individual', 'billing' => [ 'address' => [ 'line1' => '1234 Main Street', 'city' => 'San Francisco', 'state' => 'CA', 'postal_code' => '94111', 'country' => 'US', ], ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CardholderCreateParams params = CardholderCreateParams.builder() .setName("Jenny Rosen") .setEmail("jenny.rosen@example.com") .setPhoneNumber("+18008675309") .setStatus(CardholderCreateParams.Status.ACTIVE) .setType(CardholderCreateParams.Type.INDIVIDUAL) .setBilling( CardholderCreateParams.Billing.builder() .setAddress( CardholderCreateParams.Billing.Address.builder() .setLine1("1234 Main Street") .setCity("San Francisco") .setState("CA") .setPostalCode("94111") .setCountry("US") .build()) .build()) .build(); Cardholder cardholder = Cardholder.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const cardholder = await stripe.issuing.cardholders.create({ name: 'Jenny Rosen', email: 'jenny.rosen@example.com', phone_number: '+18008675309', status: 'active', type: 'individual', billing: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.IssuingCardholderParams{ Billing: &stripe.IssuingCardholderBillingParams{ Address: &stripe.AddressParams{ Country: stripe.String("US"), Line1: stripe.String("1234 Main Street"), City: stripe.String("San Francisco"), PostalCode: stripe.String("94111"), State: stripe.String("CA"), }, }, Email: stripe.String("jenny.rosen@example.com"), Name: stripe.String("Jenny Rosen"), PhoneNumber: stripe.String("+18008675309"), Status: stripe.String(string(stripe.IssuingCardholderStatusActive)), Type: stripe.String(string(stripe.IssuingCardholderTypeIndividual)), } ch, err := cardholder.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new CardholderCreateOptions { Billing = new CardholderBillingOptions { Address = new AddressOptions { Line1 = "1234 Main Street", City = "San Francisco", State = "CA", PostalCode = "94111", Country = "US", }, }, Email = "jenny.rosen@example.com", PhoneNumber = "+18008675309", Name = "Jenny Rosen", Status = "active", Type = "individual", }; var service = new CardholderService(); var cardholder = service.Create(options);

3 Create a card Server-side

After creating a cardholder, you can create a card for them. Provide the id of the Cardholder object and currency. For immediate testing, create a virtual card and set its status to active.

curl https://api.stripe.com/v1/issuing/cards \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d cardholder=ich_1Cm3pZIyNTgGDVfzI83rasFP \ -d type=virtual \ -d currency=usd \ -d status=active
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card = Stripe::Issuing::Card.create({ cardholder: 'ich_1Cm3pZIyNTgGDVfzI83rasFP', type: 'virtual', currency: 'usd', status: 'active', })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card = stripe.issuing.Card.create( cardholder='ich_1Cm3pZIyNTgGDVfzI83rasFP', type='virtual', currency='usd', status='active' )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $card = \Stripe\Issuing\Card::create([ 'cardholder' => 'ich_1Cm3pZIyNTgGDVfzI83rasFP', 'type' => 'virtual', 'currency' => 'usd', 'status' => 'active', ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CardCreateParams params = CardCreateParams.builder() .setCardholder("ich_1Cm3pZIyNTgGDVfzI83rasFP") .setType(CardCreateParams.Type.VIRTUAL) .setCurrency("usd") .setStatus(CardCreateParams.Status.ACTIVE) .build(); Card card = Card.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const card = await stripe.issuing.cards.create({ cardholder: 'ich_1Cm3pZIyNTgGDVfzI83rasFP', type: 'virtual', currency: 'usd', status: 'active', });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.IssuingCardParams{ Cardholder: stripe.String("ich_1Cm3pZIyNTgGDVfzI83rasFP"), Currency: stripe.String(string(stripe.CurrencyUSD)), Type: stripe.String(string(stripe.IssuingCardTypeVirtual)), Status: stripe.String(string(stripe.IssuingCardStatusActive)), } c, err := card.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new CardCreateOptions { Cardholder = "ich_1Cm3pZIyNTgGDVfzI83rasFP", Type = "virtual", Currency = "usd", Status = "active", }; var service = new CardService(); var card = service.Create(options);

4 Retrieve card details Server-side

You can retrieve both the full unredacted card number and CVC from the API. For security reasons, they’re only available for virtual cards and will be omitted unless you explicitly request them with the expand parameter. Additionally, they’re only available via the “Retrieve a card” endpoint.

curl https://api.stripe.com/v1/issuing/cards/ic_1Cm3paIyNTgGDVfzBqq1uqxR \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d "expand[]"=number \ -d "expand[]"=cvc \ -G
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card_details = Stripe::Issuing::Card.retrieve({ id: 'ic_1Cm3paIyNTgGDVfzBqq1uqxR', expand: ['number', 'cvc'], })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' card_details = stripe.issuing.Card.retrieve( 'ic_1Cm3paIyNTgGDVfzBqq1uqxR', expand=['number', 'cvc'] )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $card = \Stripe\Issuing\Card::retrieve([ 'id' => 'ic_1Cm3paIyNTgGDVfzBqq1uqxR', 'expand' => ['number', 'cvc'], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; CardRetrieveParams params = CardRetrieveParams.builder() .addAllExpand(Arrays.asList("number", "cvc")) .build(); Card card = Card.retrieve("ic_1Cm3paIyNTgGDVfzBqq1uqxR", params, null);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const card_details = await stripe.issuing.cards.retrieve('ic_1CoYuRKEl2ztzE5GIEDjQiUI', { expand: ['number', 'cvc'], });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.IssuingCardParams{} params.AddExpand("number") params.AddExpand("cvc") c, err := card.Get("ic_1CoYuRKEl2ztzE5GIEDjQiUI", params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new CardService(); var options = new CardGetOptions(); options.AddExpand("number"); options.AddExpand("cvc"); var details = service.Get("ic_1CoYuRKEl2ztzE5GIEDjQiUI", options);

5 Create source Server-side

Using the newly issued card’s details, create a source. A source will allow you to create a test charge as it simulates the swipe or entry of an issued card at the time of purchase. If you provide address details or a CVC, these will be compared to the values that you define when creating the card, and the comparison results will be returned.

curl https://api.stripe.com/v1/sources \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d type=card \ -d "card[number]"=4000009990000006 \ -d "card[exp_month]"=8 \ -d "card[exp_year]"=2022
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' source = Stripe::Source.create({ type: 'card', card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' source = stripe.Source.create( type='card', card={ 'number': '4000009990000006', 'exp_month': 8, 'exp_year': 2022, }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $source = \Stripe\Source::create([ 'type' => 'card', 'card' => [ 'number' => '4000009990000006', 'exp_month' => 8, 'exp_year' => 2022, ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; SourceCreateParams params = SourceCreateParams.builder() .setType("card") .putExtraParam("card[number]", "4000009990000006") .putExtraParam("card[exp_month]", "8") .putExtraParam("card[exp_year]", "2022") .build(); Source source = Source.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const source = await stripe.sources.create({ type: 'card', card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SourceObjectParams{ Type: stripe.String("card"), Currency: stripe.String(string(stripe.CurrencyUSD)), TypeData: map[string]string{ "number": "4000009990000006", "exp_month": "8", "exp_year": "2022", }, } s, err := source.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new SourceCreateOptions { Type = SourceType.Card, Currency = "usd", Card = new SourceCardOptions { Number = "4000009990000006", ExpMonth = 8, ExpYear = 2022, }, }; var service = new SourceService(); var source = service.Create(options);

6 Create an uncaptured charge Server-side

Using auth and capture, create a charge that is not immediately captured.

curl https://api.stripe.com/v1/charges \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d source=src_1Cn6EvIyNTgGDVfzosvqD8ld \ -d amount=2000 \ -d currency=usd \ -d capture=false
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' charge = Stripe::Charge.create({ source: 'src_1Cn6EvIyNTgGDVfzosvqD8ld', amount: 2000, currency: 'usd', capture: false, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' charge = stripe.Charge.create( source='src_1Cn6EvIyNTgGDVfzosvqD8ld', amount=2000, currency='usd', capture=False, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $charge = \Stripe\Charge::create([ 'source' => 'src_1Cn6EvIyNTgGDVfzosvqD8ld', 'amount' => 2000, 'currency' => 'usd', 'capture' => false, ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; ChargeCreateParams params = ChargeCreateParams.builder() .setSource("src_1Cn6EvIyNTgGDVfzosvqD8ld") .setAmount(2000L) .setCurrency("usd") .setCapture(false) .build(); Charge charge = Charge.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const charge = await stripe.charges.create({ source: 'src_1Cn6EvIyNTgGDVfzosvqD8ld', amount: 2000, currency: 'usd', capture: false, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.ChargeParams{ Amount: stripe.Int64(2000), Currency: stripe.String(string(stripe.CurrencyUSD)), Capture: stripe.Bool(false), } params.SetSource("src_1Cn6EvIyNTgGDVfzosvqD8ld") c, err := charge.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new ChargeCreateOptions { Source = "src_1Cn6EvIyNTgGDVfzosvqD8ld", Amount = 2000, Currency = "usd", Capture = false, }; var service = new ChargeService(); var charge = service.Create(options);

This step results in an authorization request. If the card has any spending controls, they’re evaluated first. If your integration is configured to receive and handle authorization requests, Stripe also sends the issuing_authorization.request event to your test authorization endpoint if the authorization is allowed by spending limits.

You can test international purchases by creating a charge in a currency that’s different from the card’s own currency (e.g., create a gbp charge for a usd card).

Managing purchases with the API

You can test how your integration handles changes to authorizations by replicating the possible actions that can occur.

Capturing an authorization (uncaptured charge)

To settle an uncaptured charge, which results in the creation of a Transaction object, capture the charge.

curl https://api.stripe.com/v1/charges/ch_1CmMk3IyNTgGDVfzqgWGCQr5/capture \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -X POST
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' charge = Stripe::Charge.capture('ch_1CmMk3IyNTgGDVfzqgWGCQr5')
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' charge = stripe.Charge.capture('ch_1CmMk3IyNTgGDVfzqgWGCQr5')
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $charge = \Stripe\Charge::retrieve('ch_1CmMk3IyNTgGDVfzqgWGCQr5'); $charge->capture();
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Charge charge = Charge.retrieve("ch_1CmMk3IyNTgGDVfzqgWGCQr5"); charge.capture();
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const charge = await stripe.charges.capture('ch_1CmMk3IyNTgGDVfzqgWGCQr5');
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" ch, err := charge.Capture("ch_1CmMk3IyNTgGDVfzqgWGCQr5")
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new ChargeService(); var charge = service.Capture("ch_1CmMk3IyNTgGDVfzqgWGCQr5");

Partial capture

You can capture an authorization for an amount below what’s been authorized. You can partially capture a test charge by providing a value for amount when capturing a charge.

Partially capturing a charge creates a Transaction object for the amount captured, and a reversal of the remaining amount. This reversal is represented as an update to the Authorization object.

Reversing an authorization

You can reverse (i.e., void) an authorization that hasn’t been captured by creating a refund for the uncaptured charge.

curl https://api.stripe.com/v1/refunds \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d charge=ch_1CmMk3IyNTgGDVfzqgWGCQr5
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' refund = Stripe::Refund.create({ charge: 'ch_1CmMk3IyNTgGDVfzqgWGCQr5', })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' refund = stripe.Refund.create( charge='ch_1CmMk3IyNTgGDVfzqgWGCQr5' )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $refund = \Stripe\Refund::create([ 'charge' => 'ch_1CmMk3IyNTgGDVfzqgWGCQr5', ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; RefundCreateParams params = RefundCreateParams.builder() .setCharge("ch_1CmMk3IyNTgGDVfzqgWGCQr5") .build(); Refund refund = Refund.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const refund = await stripe.refunds.create({ charge: 'ch_1CmMk3IyNTgGDVfzqgWGCQr5', });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.RefundParams{ Charge: stripe.String("ch_1CmMk3IyNTgGDVfzqgWGCQr5"), } ref, err := refund.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new RefundCreateOptions { Charge = "ch_1CmMk3IyNTgGDVfzqgWGCQr5", }; var service = new RefundService(); var refund = service.Create(options);

Refunding a captured charge

Refunding a captured charge uses the same method as refunding an uncaptured one. A Transaction object of type refund is created that references the original authorization.

curl https://api.stripe.com/v1/refunds \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d charge=ch_1CmMk3IyNTgGDVfzqgWGCQr5 \ -d amount=2000
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' refund = Stripe::Refund.create({ charge: 'ch_1CmMk3IyNTgGDVfzqgWGCQr5', amount: 2000, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' refund = stripe.Refund.create( charge='ch_1CmMk3IyNTgGDVfzqgWGCQr5', amount=2000, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $refund = \Stripe\Refund::create([ 'charge' => 'ch_1CmMk3IyNTgGDVfzqgWGCQr5', 'amount' => 2000, ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; RefundCreateParams params = RefundCreateParams.builder() .setCharge("ch_1CmMk3IyNTgGDVfzqgWGCQr5") .setAmount(2000L) .build(); Refund refund = Refund.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const refund = await stripe.refunds.create({ charge: 'ch_1CmMk3IyNTgGDVfzqgWGCQr5', amount: 2000, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.RefundParams{ Charge: stripe.String("ch_1CmMk3IyNTgGDVfzqgWGCQr5"), Amount: stripe.Int64(2000), } ref, err := refund.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new RefundCreateOptions { Charge = "ch_1CmMk3IyNTgGDVfzqgWGCQr5", Amount = 2000, }; var service = new RefundService(); var refund = service.Create(options);

Testing verification outcomes

Issued cards support AVS and CVC checks. You can simulate authorizations that either provide the wrong information so these checks fail, or no information so the checks can’t be run. The results of these checks are represented on Authorization objects as values for verification_data.

When creating a Source object for an issued card, providing address and CVC information is optional. If they’re not provided, the resulting ZIP code, street address, and CVC checks return not_provided. To test AVS and CVC checks, provide an address, a CVC, or both during Source creation.

curl https://api.stripe.com/v1/sources \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d type=card \ -d "card[number]"=4000009990000006 \ -d "card[exp_month]"=8 \ -d "card[exp_year]"=2022 \ -d "card[cvc]"=123 \ -d "owner[address][line1]"="1234 Main Street" \ -d "owner[address][city]"="San Francisco" \ -d "owner[address][state]"=CA \ -d "owner[address][postal_code]"=94111 \ -d "owner[address][country]"=US
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' source = Stripe::Source.create({ card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, cvc: 123, }, type: 'card', owner: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' source = stripe.Source.create( type='card', card={ 'number': '4000009990000006', 'exp_month': 8, 'exp_year': 2022, 'cvc': 123, }, owner={ 'address': { 'line1': '1234 Main Street', 'city': 'San Francisco', 'state': 'CA', 'postal_code': '94111', 'country': 'US', }, }, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $source = \Stripe\Source::create([ 'type' => 'card', 'card' => [ 'number' => '4000009990000006', 'exp_month' => 8, 'exp_year' => 2022, 'cvc' => 123, ], 'owner' => [ 'address' => [ 'line1' => '1234 Main Street', 'city' => 'San Francisco', 'state' => 'CA', 'postal_code' => '94111', 'country' => 'US', ], ], ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; SourceCreateParams params = SourceCreateParams.builder() .setType("card") .setOwner( SourceCreateParams.Owner.builder() .setAddress( SourceCreateParams.Owner.Address.builder() .setLine1("1234 Main Street") .setCity("San Francisco") .setState("CA") .setPostalCode("94111") .setCountry("US") .build()) .build()) .putExtraParam("card[number]", "4000009990000006") .putExtraParam("card[exp_month]", "8") .putExtraParam("card[exp_year]", "2022") .putExtraParam("card[cvc]", "314") .build(); Source source = Source.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const source = await stripe.sources.create({ type: 'card', card: { number: '4000009990000006', exp_month: 8, exp_year: 2022, cvc: 123, }, owner: { address: { line1: '1234 Main Street', city: 'San Francisco', state: 'CA', postal_code: '94111', country: 'US', }, }, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SourceParams{ Type: stripe.String("card"), Card: &stripe.CardParams{ Number: stripe.String("4000009990000006"), ExpMonth: stripe.String("8"), ExpYear: stripe.String("2022"), CVC: stripe.String("123"), }, Owner: &stripe.SourceOwnerParams{ Address: &stripe.AddressParams{ Line1: stripe.String("1234 Main Street"), City: stripe.String("San Francisco"), PostalCode: stripe.String("94111"), State: stripe.String("CA"), Country: stripe.String("US"), }, }, } s, err := source.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new SourceCreateOptions { Type = "card", Card = new SourceCardOptions { Number = "4000009990000006", ExpMonth = 8, ExpYear = 2022, Cvc = "123", }, Owner = new SourceOwnerOptions { Address = new AddressOptions { Line1 = "1234 Main Street", City = "San Francisco", PostalCode = "94111", State = "CA", Country = "US", }, }, }; var service = new SourceService(); var source = service.Create(options);

Providing the same address as the billing address on the card results in a successful AVS check (the respective verification_data fields return match) and providing the correct CVC (the value returned in the card details) does the same for the CVC check.

To test for a failed check, create a source that has a different ZIP code, street address, and CVC—this results in verification_data returning mismatch.