Test basic payment requests in Postman

If you’ve already started building your app and know which Payments APIs you want to use, you can use Postman to start testing your production code.

Here are basic QuickBooks Payments API requests and operations you can test in Postman.

Set up Postman

If you haven’t already, get the QuickBooks Payments collections and set up your Postman testing environment. Then come back to this guide.

Get access tokens for Postman

You need to create access tokens to send tests requests. Tokens are valid for 60 minutes.

Test payments requests

Collections give pre-builts requests you can use for your QuickBooks test company. Here are a few you can try:

Create a charge
  1. In Postman, select the Collections menu.
  2. Select the Charges folder and then (Post) Charges-Create.
  3. Review to the Authorization tab. Make sure the Type dropdown is OAuth 2.0 and the Add authorization data to dropdown is Request Headers.
  4. Select a token from the Access Token dropdown.
  5. Review the request in the Body tab.
  6. Select Send.

This creates a new charge and sends a charge request - these are the most common activities for payment processing. Go to the Body tab to see the server response. The charge’s status should be CAPTURED.

Get the status of an existing charge

After you have created a charge, you can check it’s status:

  1. Open the original charge.
  2. In the Body tab, review the server response.
  3. Copy the value for the id field. Don’t copy the quotes.
  4. Select the Collections menu.
  5. Select the Charges folder and then (GET) Charges-Retrieve.
  6. In the endpoint, replace <enter_your_charge_id> with the original charge’s value for the id field.
  7. Review to the Authorization tab. Make sure the Type dropdown is OAuth 2.0 and the Add authorization data to dropdown is Request Headers.
  8. Select a token from the Access Token dropdown.
  9. Review the request in the Body tab.
  10. Select Send.

The server response should show details and and the charge’s status as CAPTURED. If the charge was refunded, the status should be REFUNDED.

Refund an existing charge
  1. Open the charge you want to refund.
  2. In the Body tab, review the server response.
  3. Copy the value for the id field. Don’t copy the quotes.
  4. Select the Collections menu.
  5. Select the Charges folder and then POST Charges-RefundCharge.
  6. In the endpoint, replace <enter_your_charge_id> with the refund charge’s value for the id field.
  7. Review to the Authorization tab. Make sure the Type dropdown is OAuth 2.0 and the Add authorization data to dropdown is Request Headers.
  8. Select a token from the Access Token dropdown.
  9. Go to the Body tab.
  10. Leave the value in the amount field as is to give a full refund. Or, change the value to give a partial refund.
  11. Select Send.

This refunds the charge. The server response should show the status for both full and partial refunds as ISSUED.

Void a charge

You can void an existing charge as long as its status isn’t completed.

If it’s already completed, do a full refund for the charge instead.

  1. Open the charge you want to void.
  2. Open the Environment Quick Look window.
  3. Copy the value for the guid-without-dashes variable.
  4. Select the Collections menu.
  5. Select the Charges folder and then POST Charges-VoidCharge.
  6. In the endpoint, replace <enter_your_request_charge_id> with the value for the guid-without-dashes variable.
  7. Review to the Authorization tab. Make sure the Type dropdown is OAuth 2.0 and the Add authorization data to dropdown is Request Headers.
  8. Select a token from the Access Token dropdown.
  9. Review the request in the Body tab.
  10. Select Send.

This voids the charge. The server response should show the void’s status as ISSUED.

Save a credit card
  1. Select the Collections menu.
  2. Select the Cards folder and then POST Cards-Create.
  3. In the endpoint, replace <enter_your_customer_id> with the customer id for the customer you want to save the card for.
  4. Review to the Authorization tab. Make sure the Type dropdown is OAuth 2.0 and the Add authorization data to dropdown is Request Headers.
  5. Select a token from the Access Token dropdown.
  6. Go to the Body tab.
  7. In the number field, enter the credit card number you want to save.
  8. Select Send.

This saves the credit card info for the customer id you put in the endpoint. The server response should show the status as ACTIVE.

Use a saved credit card to create a charge
  1. Open the saved credit card post.
  2. In the Body tab, review the server response.
  3. Copy the value for the id field. Don’t copy the quotes.
  4. Select the Collections menu.
  5. Select the Charges folder and then POST Charges-CreateFrom CardOnFile.
  6. Review to the Authorization tab. Make sure the Type dropdown is OAuth 2.0 and the Add authorization data to dropdown is Request Headers.
  7. Select a token from the Access Token dropdown.
  8. Go to the Body tab.
  9. In the cardOnFile field, enter the id for the saved credit card. Note: This is not the actual credit card number.
  10. Select Send.

This uses the saved credit card to create a new charge. The server response should show the charge’s status as CAPTURED.