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 refunds sim

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

1. Open the refunds Simulator

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

To open the simulator interface, login to your Testing Pays account and click "OPEN" on the "refunds" 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 refund 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 refunds 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 refund, at minimum you need a charge id and amount. Using cURL, you need to submit these parameters as you would with a form POST.

Our Tip: add more details on your refund requests

You can add more parameters to your refunds: metadata, reason for refund or the application fee (for connected account). It's important to provide as much detail and metadata as possible for refunds.

3. Making your first refunds request

Next, your code needs to send the assembled request to the refunds 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 refunds request using cURL.

curl -X POST -u API_KEY: \
  -d amount=500 \
  -d charge=ch_sa9sd9f8asdf98329as9df \
  https://api.testingpays.com/API_KEY/stripe/v1/refunds

4. Parse the refunds response

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

{
  "id": "re_yNVpaqaC1I8PAlTLMyfB3DEs",
  "object": "refund",
  "amount": 100,
  "balance_transaction": "txn_CzhhmV0CSrx4J5GMs7UD2MYb",
  "charge": "ch_19zmXfDPjEFprg5kXmfIlmfc",
  "created": 1550495639,
  "currency": "eur",
  "metadata": { },
  "reason": null,
  "receipt_number": null,
  "status": "succeeded"
}

What's Next

Get a webhook callback within seconds and integrate the full payment, subscription and invoice flow in your

Webhooks NEW
  • Testing Pays is a product of The Payment Works.
  • GDPR
  • Contact