Here's how to make your first request - creating a card token - with Testing Pays sims.
First, you’ll need an account on Testing Pays. It takes seconds.
Create your Testing Pays accountFor the purposes of making test token call, you'll be using the tokens simulator in your Testing Pays account.
To open the simulator interface, login to your Testing Pays account and click "OPEN" on the "tokens" bookmark on your dashboard. You'll see the following sections in your simulator:
The simplest option is using cURL. To create a Stripe token, at minimum you need a card[number], card[exp_month], card[exp_year] and card[cvc]. Using cURL, you need to submit these parameters as you would with a form POST.
Add address details to your request. This can be used in billing and customer details later.
Remember: you can trigger different responses from the simulator by the values you use in the requests. By default, the simulator will use cvc value as the trigger value.
Next, your code needs to send the assembled request to the tokens 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.
curl -X POST -u API_KEY: \
-d card[number]=4111111111111111 \
-d card[exp_month]=12 \
-d card[exp_year]=25 \
-d card[cvc]=100 \
https://api.testingpays.com/API_KEY/stripe/v1/tokens
The simulator will send back a JSON object that contains information about the card or bank account. These details can be saved safely in your own systems (i.e. the last 4 digits and the card type). You can show these to your customer(s), helping them to identify their preferred payment option - this is especially important when a customer has multiple cards saved.
Take a look at an example response:
{
"id": "tok_VA1AHiaFbceQKOur3QZ87Y11",
"object": "token",
"card": {
"id": "card_aLUvGXRXygx8cuwSIWXvmsm6",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "unchecked",
"dynamic_last4": null,
"exp_month": 12,
"exp_year": 25,
"fingerprint": "cpDLiFvOzL0OEy6o",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1550495473,
"livemode": false,
"type": "card",
"used": false
}
Tokens are the single reference you need to create charges, so it’s essential to remember them. You need to use it when creating customers, subscribing to plans, etc.
Explore how you can use Tokens: for charges, customers, subscriptions, etc.