Charging a Credit Card

Step 1. Tokenize the Card

Post properly constructed JSON (see sample below) to one of theses URLs. 

If you are using an API Key you got for a Sandbox account make sure you use the Sandbox URL. Even though you won't need your API Key for this request.

Sample JSON
{ 	

	"card": { 		
	"expYear": "2020",
	"expMonth": "02",
	"address": {
		"region": "CA",
		"postalCode": "94086",
		"streetAddress": "1130 Kifer Rd",
		"country": "US",
		"city": "Sunnyvale" 		
	}, 		
	"name": "emulate=0",
	"cvc": "123",
	"number": "4111111111111111"
 	}
 }
	

You should get back a bit of JSON like this

{   
"value": "c6901930-7047-47d3-a80d-5885aad48b6b"
}

your token is in the value property.

Reference

You can find Intuit's docs on this process here -   https://developer.intuit.com/docs/api/payments/tokens

Intuit also has a bunch of test card numbers, and ways of simulating errors you can use here. -   https://developer.intuit.com/docs/0100_quickbooks_online/0200_dev_guides/payments/testing

Make sure you use your API Key as the user name with Basic Authentication.

{
"cardToken": "ea8d19f2-094a-415f-a30d-1a5adfb65f2e",
"amount" : "80.02"
}

Headers

  • Content-Type : 'application/json'
  • Accept : 'application/json'

Response

The response should look like this. If the "status" is "CAPTURED," then the charge went through.

{   
"created": "2016-11-05T19:45:52Z",
   "status": "CAPTURED",
   "amount": "80.02",
   "currency": "USD",
   "token": "07084b07-9985-4035-a039-f6d02199067a",
   "description": "",
   "avsStreet": "Pass",
   "avsZip": "Pass",
   "cardSecurityCodeMatch": "NotAvailable",
   "id": "EE3G4LDE6O4Z",
   "context": {
     "recurring": false,
     "mobile": false,
     "deviceInfo": {}   
},
   "authCode": "306329" 
}

Reference

Intuit's documentation on creating a charge

https://developer.intuit.com/docs/api/payments/charges

Still need help? Contact Us Contact Us