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

Getting Started with the customers sim

  1. Step 1: Open the customers simulator
  2. Step 2: Build the payload
  3. Step 3: Send the request to the customers simulator
  4. Step 4: Parse the customers response

1. Open the customers Simulator

For the purposes of making test customers call, you'll be using the customers simulator in your Testing Pays account.

To open the simulator interface, login to your Testing Pays account and click "OPEN" on the "customers" bookmark on your dashboard. You'll see the following sections in your simulator:

  • Integrate: coding instructions in various languages to help you connect your code to the simulator.
  • Debug: use the Live Log to watch transactions being processed in real-time. Or download the file-based logs.
  • Test: a map of real customer response codes that you can trigger with values in your test requests. Or custom your own.
  • Reports: real-time test reports showing the frequency and coverage of your customers testing.
  • Settings: real-world settings you can activate for your testing like latency delays, trigger parameters, etc.

2. Build the payload

The simplest option is using cURL. To create a Stripe customer, at minimum you need a source (this is the card or bank account token you get back from tokens). Testing Pays also require you to send in an `account_balance` to trigger the various test scenarios. Using cURL, you need to submit these parameters as you would with a form POST.

Our Tip: create customer objects with care

Technically you don’t need any params to create customer, but this makes it very hard to identify them later! Be sure you include `description` and `email`. You can also add metadata here too, like on all the other Stripe APIs.

3. Making your first customers request

Next, your code needs to send the assembled request to the customers simulator. The URL to POST to can be found under the "Integration" tab of the simulator - make sure to copy&paste this URL from your simulator as it contains your unique API_KEY.

The example shown below shows how to make a customers request using cURL.

curl -X POST -u API_KEY: \
  -d account_balance=10000 \
  -d description=”T. Pais account” \
  -d email=”tp@email.com” \
  https://api.testingpays.com/API_KEY/stripe/v1/customers

4. Parse the customers response

The simulator will send back a JSON object that contains information about the customer - echoing back your call details along with the defaults

{
  "id": "cus_0UEt8BuOdOaYr79bJ3i00sMA",
  "object": "customer",
  "account_balance": 100,
  "created": 1550495681,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": null,
  "discount": null,
  "email": null,
  "invoice_prefix": "lkUSL7v",
  "invoice_settings": {
    "custom_fields": null,
    "footer": null
  },
  "livemode": false,
  "metadata": {},
  "shipping": null,
  "sources": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_0UEt8BuOdOaYr79bJ3i00sMA/sources"
  },
  "subscriptions": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_0UEt8BuOdOaYr79bJ3i00sMA/subscriptions"
  },
  "tax_info": null,
  "tax_info_verification": null
}

What's Next

Managing billing for subscriptions - plans, upgrades, downgrades, etc.

Subscriptions API
  • Testing Pays is a product of The Payment Works.
  • GDPR
  • Contact