Testing Pays
  • Features
  • Benefits
  • Guides
  • Pricing
  • Getting Started
  • About
  • Contact
  • Login
  • Signup

Stripe Basics

Welcome Sim Features What can I do?

API reference

What's Stripe? Tokens - Getting started Charges Customers Subscriptions Coupons Refunds Webhooks FAQ

What are the Stripe sims?

Stripe has a cornucopia of APIs that deal with payments. You can do everything from simple charges to order management. You can even use it as a marketplace, where you connect payments from one source to another, making you the middleman for such transactions.

On top of this, Stripe’s APIs are fairly spread out, each endpoint following the REST principles where applicable. Reading through all that can be daunting at times, so we have attempted to boil it down to some simple steps

Doing a one-off charge

This way you can make simple transaction without remembering any details of your customer.

  1. Get the customer’s card details TOKENised first. Tokenisation means you get an ID which can be used to reference the card in use. Using the token means you won’t be subject to rigorous PCI complience reviews (you aren’t fully off the hook though!). At this point the only thing that happened is that the card details have been registered with Stripe.
  2. With the token, you can create a CHARGE. Charging the card will actually take money off the account - whether it’s through a one-step auth+capture or 2 separate calls that’s up to you. You will receive back a CHARGE object on this call, which includes important information about the transaction: The result from Stripe, the issuer (the institution that gave the card to the customer, i.e. the issuing bank, or the card schemes themselves) and acquirer (the institution that takes the money off the card). Each of these parties have a say in the outcome of a transaction, and all three’s `OK` is needed to get a successful charge completed.

Saving and reusing the customer details

Use this flow to remember customer details (including card / bank account details).

  1. Now, before the CHARGE you can create a CUSTOMER object in stripe. This customer object can be used in any later action on the Stripe APIs, making it easier to reference the person’s details (billing, delivery, email, etc.) and payment options. You can add and store multiple cards & bank accounts on a customer object!
  2. In your CHARGE request now you will use the TOKEN as the source and the CUSTOMER ID as well. This way you can later review all transactions in your dashboard (or by listing all CHARGES using the REST API)

Refunding a charge

  1. In some cases you need to issue a REFUND to a customer (i.e. returning goods, exchange, not satisfied with the service, duplicate transaction, etc.). You can do so by using the REFUNDS API.
  2. Here you need to reference the original CHARGE you’re refunding, using the charge ID. By default it will issue a refund on the full amount, however you can do partial refunds with the `amount` parameter. And if it’s between connected account (the marketplace scenario) then you can attach an application fee as well.

Using Coupons

  1. You can use Stripe’s APIs to issue COUPONs and discounts - you don’t need to calculate these on each charge!
  2. Coupons can be a fix amount off the price or a fix percentage off the price. When you use subscriptions you can even configure them to be time based: 3 month off, half price for 12 months, etc.
  3. Create these coupons either on the dashboard or using the COUPONs API.
  4. Coupons can be applied to new or existing SUBSCRIPTIONS

Managing Subscriptions

  1. Running a subscription based business is manageable through Stripe’s APIs
  2. First you need to setup your PLANs on Stripe. These plans will be the base of your subscriptions.
  3. Each plan has to have a name (id), a duration (i.e. monthly, annual) and a price.
  4. These plans then can be added as SUBSCRIPTION ITEMS to a customer’s subscription.
  5. One subscription can contain many items. Think of it as a magazine subscription, where you can subscribe for a specific paper, or a family of papers. Then you can manage these individually later.
  6. TIP: you can subscribe to a single plan many times using the `quantity` request parameter.
  7. You can also set trial periods, cancellations and coupons on a customer’s subscriptions
  8. When it comes to usage-based billing, that’s doable through

What's Next

Get going with the Tokens sim.

Getting Started with Tokens
  • Testing Pays is a product of The Payment Works.
  • GDPR
  • Contact